Public report of alibaba/druid, published 13 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 reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.3). 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, 13 November 2026, 13:50 UTC · Survey ID cd_fab530c98e5f483ca03852ecd52b8f6f
alibaba/druid
Measured 13 November 2026, 13:49 UTC, at code version fa8dc99
CAI scoreAt riskUp 3 since the last survey
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 large codebase: 272,789 lines of product code in 6 projects, tests not counted · Estimated rebuild effort: about 3.0 person-years · Weakest lens: Accessibility, 35
Findings by how serious they are
132 critical4260 serious311 minor
15 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
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
13 November 2026, 13:49 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.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
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 ▸
71of 71 dimensions measured by tools.
4578of 4703 findings point to an exact file and line, so you can open each one in the code. The other 125 concern the repository as a whole, such as missing documentation.
71dimensions across 7 lenses, read from 272,789 lines of product code in 6 projects.
alibaba/druid is rated At risk because critical security findings are open, most of them in the packages it uses. Its score is held back in part because it has images with no text description. It scores 44 out of 100, which the At risk rating leaves unchanged.
Accessibility, at 35, is the weakest lens and counts most in the score. The best first step is replacing the two exposed passwords or keys and switching the old ones off, worth about 5 points. Making the controls keyboard-usable would lift Accessibility itself, worth about 4 points. Raising Accessibility to 70 would lift the score to about 51.
Fifty-nine known security holes in the packages the code depends on can be used by attackers. Four places in the code run text as code, which an attacker could use, and twenty form fields can't be read by a screen reader. Updating the vulnerable packages, replacing text run as code with direct calls and labelling the form fields would close these risks. Pinning each tool to an exact version would fix the three pipeline tools referenced by a changeable name, and the two passwords or keys in the code need replacing, with the old ones switched off. The 16 tests that check nothing need to check the result they produce.
The product code is 272,789 lines, about €440,000 to rebuild.
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 forThe 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.
If Accessibility rose from 35 to 70, the lowest score rated Strong, the score would rise from 44 to about 51.
Code composition: what the lines of code are
Product code 54%Tests 46%
New since the last survey: 401 findings
These 401 critical or serious findings weren't in the previous survey, on 24 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java
Code Duplication · Edited copy of a member (186 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java
Code Duplication · Edited copy of a member (131 corresponding lines) core/src/main/java/com/alibaba/druid/util/JdbcUtils.java
Code Duplication · Edited copy of a member (130 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java
Code Duplication · Edited copy of a member (100 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java
Code Duplication · Edited copy of a member (78 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java
Code Duplication · Edited copy of a member (75 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java
Code Duplication · Edited copy of a member (93 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java
Code Duplication · Edited copy of a member (82 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java
Code Duplication · Edited copy of a member (77 corresponding lines) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java
Code Duplication · Edited copy of a member (99 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java
Code Duplication · Edited copies of one member (3 members, 77+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java
Code Duplication · Edited copy of a member (78 corresponding lines) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java
Code Duplication · Edited copy of a member (94 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java
Code Duplication · Edited copy of a member (74 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java
Code Duplication · Edited copy of a member (56 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java
Code Duplication · Edited copy of a member (70 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java
Code Duplication · Edited copy of a member (46 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java
Code Duplication · Edited copies of one member (3 members, 60+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java
Code Duplication · Edited copy of a member (37 corresponding lines) druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java
Code Duplication · Edited copy of a member (43 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStatValue.java
Code Duplication · Edited copy of a member (58 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java
Code Duplication · Edited copy of a member (59 corresponding lines) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java
Code Duplication · Edited copy of a member (54 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java
Code Duplication · Edited copy of a member (49 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java
Code Duplication · Edited copy of a member (47 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java
Code Duplication · Edited copy of a member (51 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java
Code Duplication · Edited copy of a member (61 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java
Code Duplication · Edited copies of one member (3 members, 58+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java
Code Duplication · Edited copy of a member (45 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java
Code Duplication · Edited copy of a member (45 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java
Code Duplication · Edited copy of a member (41 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lpad.java
Code Duplication · Edited copies of one member (3 members, 54+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java
Code Duplication · Edited copy of a member (37 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java
Code Duplication · Edited copy of a member (45 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java
Code Duplication · Edited copies of one member (3 members, 50+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java
Code Duplication · Edited copy of a member (44 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java
Code Duplication · Edited copy of a member (47 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java
Code Duplication · Edited copy of a member (26 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (49 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java
Code Duplication · Edited copy of a member (39 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java
Code Duplication · Edited copy of a member (36 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java
Code Duplication · Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java
Code Duplication · Edited copy of a member (33 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java
Code Duplication · Edited copy of a member (36 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java
Code Duplication · Edited copy of a member (39 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java
Code Duplication · Edited copies of one member (3 members, 35+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java
Code Duplication · Edited copies of one member (3 members, 35+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java
Code Duplication · Edited copy of a member (50 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java
Code Duplication · Edited copy of a member (39 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java
Code Duplication · Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java
Code Duplication · Edited copy of a member (31 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java
Code Duplication · Edited copies of one member (3 members, 37+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java
Code Duplication · Edited copy of a member (38 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java
Code Duplication · Edited copy of a member (15 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelect.java
Code Duplication · Edited copy of a member (46 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java
Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java
Code Duplication · Edited copy of a member (33 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java
Code Duplication · Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java
Code Duplication · Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java
Code Duplication · Edited copy of a member (35 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java
Code Duplication · Edited copy of a member (41 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java
Code Duplication · Edited copy of a member (31 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java
Code Duplication · Edited copy of a member (24 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Greatest.java
Code Duplication · Edited copy of a member (32 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java
Code Duplication · Edited copy of a member (28 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java
Code Duplication · Edited copy of a member (38 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java
Code Duplication · Edited copy of a member (25 corresponding lines) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java
Code Duplication · Edited copy of a member (25 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java
Code Duplication · Edited copy of a member (25 corresponding lines) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java
Code Duplication · Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java
Code Duplication · Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java
Code Duplication · Edited copy of a member (28 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java
Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java
Code Duplication · Edited copy of a member (32 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java
Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java
Code Duplication · Edited copy of a member (26 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java
Code Duplication · Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java
Code Duplication · Edited copies of one member (4 members, 31+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java
Code Duplication · Edited copy of a member (18 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java
Code Duplication · Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftCreateTableParser.java
Code Duplication · Edited copy of a member (34 corresponding lines) core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java
Code Duplication · Edited copy of a member (37 corresponding lines) core/src/main/java/com/alibaba/druid/support/monitor/MonitorClient.java
Code Duplication · Edited copy of a member (25 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java
Code Duplication · Edited copy of a member (26 corresponding lines) core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java
Code Duplication · Edited copy of a member (32 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java
Code Duplication · Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/support/opds/udf/ExportConditionColumns.java
Code Duplication · Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java
Code Duplication · Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java
Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java
Code Duplication · Edited copy of a member (21 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java
Code Duplication · Edited copy of a member (23 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java
Code Duplication · Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java
Code Duplication · Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java
Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java
Code Duplication · Edited copy of a member (21 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java
Code Duplication · Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/stat/TableStat.java
Code Duplication · Edited copy of a member (25 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/SQLPivot.java
Code Duplication · Edited copy of a member (26 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 385 findings
These 385 critical or serious findings were in the previous survey, on 24 October 2026, and are gone from this one. The first 100 are listed here.
Code Duplication · Near-duplicate member pair (141 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java
Code Duplication · Near-duplicate member pair (64 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java
Code Duplication · Near-duplicate member pair (52 shared lines) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java
Code Duplication · Near-duplicate member pair (29 shared lines) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java
Code Duplication · Edited copy of a member (33 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java
Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
Documentation (README) · README may be stale
Page structure · <html> without a lang REDACTED
Page structure · Page without a main landmark REDACTED
Page structure · Data table has no header cells REDACTED
Page structure · <html> without a lang core/src/main/resources/support/http/resources/weburi.html
Page structure · Page without a main landmark core/src/main/resources/support/http/resources/weburi.html
Page structure · <html> without a lang druid-admin/src/main/resources/support/http/resources/activeConnectionStackTrace.html
Page structure · Page without a main landmark druid-admin/src/main/resources/support/http/resources/activeConnectionStackTrace.html
Page structure · <html> without a lang druid-admin/src/main/resources/support/http/resources/api.html
Page structure · Page without a main landmark druid-admin/src/main/resources/support/http/resources/api.html
Page structure · <html> without a lang REDACTED
Page structure · Page without a main landmark REDACTED
Page structure · <html> without a lang druid-admin/src/main/resources/support/http/resources/datasource.html
Page structure · Page without a main landmark druid-admin/src/main/resources/support/http/resources/datasource.html
Page structure · <html> without a lang druid-admin/src/main/resources/support/http/resources/index.html
Page structure · Page without a main landmark druid-admin/src/main/resources/support/http/resources/index.html
Page structure · Data table has no header cells druid-admin/src/main/resources/support/http/resources/index.html
Page structure · Page without a main landmark druid-admin/src/main/resources/support/http/resources/login.html
Rebuild cost: about €440,000 · Estimate
Cost to rebuild
€150,000 to €740,000, for 2,440 to 7,742 hours of work, about 3.0 person-years for 1 to 6 engineers
Difficulty of the problem
Standard, 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.7 at a score of 44. 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.
Size
Large: 272,789 lines of product code
What it is not
Not 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 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2).
Raises the score by about 5 points · Low effort · Secret Scanning
2
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Raises the score by about 4 points · Medium effort · Text alternatives
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 €440,000 to build again, about 3.0 person-years of work. Its weakest lens is Accessibility, at 35 (Weak). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
Resolve the 2 Leaked secret finding(s) in Secret Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 5 points for low effort, because it clears the 2 Secret Scanning 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 6.4 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 3,604 lines over the last 90 days, which is about 14,616 lines a year. At that pace, the extra work comes to an estimated 1.5 to 8.8 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.
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.
221 modules, with 855 dependencies between them. 15 loops run through 86 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 181 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.
druid.filter.stat uses druid.support.logging, so a change to druid.support.logging can break druid.filter.stat, while a change to druid.filter.stat can't break druid.support.logging.
Position
Below the diagonal: druid.filter.stat uses a module listed above it, which is the healthy direction.
3→35 druid.filter.stat uses druid.statpart of a loop✕
Connections
5 pairs of types, where a type in druid.filter.stat uses a type in druid.stat.
druid.filter.stat uses druid.proxy.jdbc, so a change to druid.proxy.jdbc can break druid.filter.stat, while a change to druid.filter.stat can't break druid.proxy.jdbc.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
3→38 druid.filter.stat uses druid.poolpart of a loop✕
Connections
2 pairs of types, where a type in druid.filter.stat uses a type in druid.pool.
druid.filter.stat uses druid.filter, so a change to druid.filter can break druid.filter.stat, while a change to druid.filter.stat can't break druid.filter.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
4→18 druid.sql.dialect.db2.visitor uses druid.sql.repositorypart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.db2.visitor uses a type in druid.sql.repository.
druid.sql.dialect.db2.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.dialect.db2.visitor, while a change to druid.sql.dialect.db2.visitor can't break druid.sql.repository.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
4→22 druid.sql.dialect.db2.visitor uses druid.sql.visitorpart of a loop✕
Connections
6 pairs of types, where a type in druid.sql.dialect.db2.visitor uses a type in druid.sql.visitor.
druid.sql.dialect.db2.visitor uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.db2.visitor, while a change to druid.sql.dialect.db2.visitor can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
4→26 druid.sql.dialect.db2.visitor uses druid.sql.ast.statementpart of a loop✕
Connections
4 pairs of types, where a type in druid.sql.dialect.db2.visitor uses a type in druid.sql.ast.statement.
druid.sql.dialect.db2.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.db2.visitor, while a change to druid.sql.dialect.db2.visitor can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
4→27 druid.sql.dialect.db2.visitor uses druid.sql.ast.exprpart of a loop✕
Connections
18 pairs of types, where a type in druid.sql.dialect.db2.visitor uses a type in druid.sql.ast.expr.
druid.sql.dialect.db2.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.db2.visitor, while a change to druid.sql.dialect.db2.visitor can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
4→28 druid.sql.dialect.db2.visitor uses druid.sql.astpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.db2.visitor uses a type in druid.sql.ast.
druid.sql.dialect.db2.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.db2.visitor, while a change to druid.sql.dialect.db2.visitor can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.hive.stmt uses druid, so a change to druid can break druid.sql.dialect.hive.stmt, while a change to druid.sql.dialect.hive.stmt can't break druid.
Position
Below the diagonal: druid.sql.dialect.hive.stmt uses a module listed above it, which is the healthy direction.
5→19 druid.sql.dialect.hive.stmt uses druid.sql.dialect.hive.visitorpart of a loop✕
Connections
3 pairs of types, where a type in druid.sql.dialect.hive.stmt uses a type in druid.sql.dialect.hive.visitor.
druid.sql.dialect.hive.stmt uses druid.sql.dialect.hive.visitor, so a change to druid.sql.dialect.hive.visitor can break druid.sql.dialect.hive.stmt, while a change to druid.sql.dialect.hive.stmt can't break druid.sql.dialect.hive.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
5→22 druid.sql.dialect.hive.stmt uses druid.sql.visitorpart of a loop✕
Connections
4 pairs of types, where a type in druid.sql.dialect.hive.stmt uses a type in druid.sql.visitor.
druid.sql.dialect.hive.stmt uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.hive.stmt, while a change to druid.sql.dialect.hive.stmt can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
5→26 druid.sql.dialect.hive.stmt uses druid.sql.ast.statementpart of a loop✕
Connections
9 pairs of types, where a type in druid.sql.dialect.hive.stmt uses a type in druid.sql.ast.statement.
druid.sql.dialect.hive.stmt uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.hive.stmt, while a change to druid.sql.dialect.hive.stmt can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
5→28 druid.sql.dialect.hive.stmt uses druid.sql.astpart of a loop✕
Connections
9 pairs of types, where a type in druid.sql.dialect.hive.stmt uses a type in druid.sql.ast.
druid.sql.dialect.hive.stmt uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.hive.stmt, while a change to druid.sql.dialect.hive.stmt can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.mysql.ast.statement uses druid, so a change to druid can break druid.sql.dialect.mysql.ast.statement, while a change to druid.sql.dialect.mysql.ast.statement can't break druid.
Position
Below the diagonal: druid.sql.dialect.mysql.ast.statement uses a module listed above it, which is the healthy direction.
6→22 druid.sql.dialect.mysql.ast.statement uses druid.sql.visitorpart of a loop✕
Connections
25 pairs of types, where a type in druid.sql.dialect.mysql.ast.statement uses a type in druid.sql.visitor.
druid.sql.dialect.mysql.ast.statement uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.mysql.ast.statement, while a change to druid.sql.dialect.mysql.ast.statement can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
6→23 druid.sql.dialect.mysql.ast.statement uses druid.sql.dialect.mysql.ast.exprpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.mysql.ast.statement uses a type in druid.sql.dialect.mysql.ast.expr.
druid.sql.dialect.mysql.ast.statement uses druid.sql.dialect.mysql.ast.expr, so a change to druid.sql.dialect.mysql.ast.expr can break druid.sql.dialect.mysql.ast.statement, while a change to druid.sql.dialect.mysql.ast.statement can't break druid.sql.dialect.mysql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
6→24 druid.sql.dialect.mysql.ast.statement uses druid.sql.dialect.mysql.visitorpart of a loop✕
Connections
155 pairs of types, where a type in druid.sql.dialect.mysql.ast.statement uses a type in druid.sql.dialect.mysql.visitor. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.mysql.ast.statement uses druid.sql.dialect.mysql.visitor, so a change to druid.sql.dialect.mysql.visitor can break druid.sql.dialect.mysql.ast.statement, while a change to druid.sql.dialect.mysql.ast.statement can't break druid.sql.dialect.mysql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
6→25 druid.sql.dialect.mysql.ast.statement uses druid.sql.dialect.mysql.astpart of a loop✕
Connections
34 pairs of types, where a type in druid.sql.dialect.mysql.ast.statement uses a type in druid.sql.dialect.mysql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.mysql.ast.statement uses druid.sql.dialect.mysql.ast, so a change to druid.sql.dialect.mysql.ast can break druid.sql.dialect.mysql.ast.statement, while a change to druid.sql.dialect.mysql.ast.statement can't break druid.sql.dialect.mysql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
6→26 druid.sql.dialect.mysql.ast.statement uses druid.sql.ast.statementpart of a loop✕
Connections
77 pairs of types, where a type in druid.sql.dialect.mysql.ast.statement uses a type in druid.sql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.mysql.ast.statement uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.mysql.ast.statement, while a change to druid.sql.dialect.mysql.ast.statement can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
6→27 druid.sql.dialect.mysql.ast.statement uses druid.sql.ast.exprpart of a loop✕
Connections
15 pairs of types, where a type in druid.sql.dialect.mysql.ast.statement uses a type in druid.sql.ast.expr.
druid.sql.dialect.mysql.ast.statement uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.mysql.ast.statement, while a change to druid.sql.dialect.mysql.ast.statement can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
6→28 druid.sql.dialect.mysql.ast.statement uses druid.sql.astpart of a loop✕
Connections
208 pairs of types, where a type in druid.sql.dialect.mysql.ast.statement uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.mysql.ast.statement uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.mysql.ast.statement, while a change to druid.sql.dialect.mysql.ast.statement can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
7→13 druid.sql.dialect.oracle.ast.expr uses druid.sql.dialect.oracle.visitorpart of a loop✕
Connections
14 pairs of types, where a type in druid.sql.dialect.oracle.ast.expr uses a type in druid.sql.dialect.oracle.visitor.
druid.sql.dialect.oracle.ast.expr uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.dialect.oracle.ast.expr, while a change to druid.sql.dialect.oracle.ast.expr can't break druid.sql.dialect.oracle.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
7→14 druid.sql.dialect.oracle.ast.expr uses druid.sql.dialect.oracle.astpart of a loop✕
Connections
6 pairs of types, where a type in druid.sql.dialect.oracle.ast.expr uses a type in druid.sql.dialect.oracle.ast.
druid.sql.dialect.oracle.ast.expr uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.dialect.oracle.ast.expr, while a change to druid.sql.dialect.oracle.ast.expr can't break druid.sql.dialect.oracle.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
7→22 druid.sql.dialect.oracle.ast.expr uses druid.sql.visitorpart of a loop✕
Connections
9 pairs of types, where a type in druid.sql.dialect.oracle.ast.expr uses a type in druid.sql.visitor.
druid.sql.dialect.oracle.ast.expr uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.oracle.ast.expr, while a change to druid.sql.dialect.oracle.ast.expr can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
7→26 druid.sql.dialect.oracle.ast.expr uses druid.sql.ast.statementpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.oracle.ast.expr uses a type in druid.sql.ast.statement.
druid.sql.dialect.oracle.ast.expr uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.oracle.ast.expr, while a change to druid.sql.dialect.oracle.ast.expr can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
7→27 druid.sql.dialect.oracle.ast.expr uses druid.sql.ast.exprpart of a loop✕
Connections
3 pairs of types, where a type in druid.sql.dialect.oracle.ast.expr uses a type in druid.sql.ast.expr.
druid.sql.dialect.oracle.ast.expr uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.oracle.ast.expr, while a change to druid.sql.dialect.oracle.ast.expr can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
7→28 druid.sql.dialect.oracle.ast.expr uses druid.sql.astpart of a loop✕
Connections
39 pairs of types, where a type in druid.sql.dialect.oracle.ast.expr uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oracle.ast.expr uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.oracle.ast.expr, while a change to druid.sql.dialect.oracle.ast.expr can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.sqlserver.visitor uses druid, so a change to druid can break druid.sql.dialect.sqlserver.visitor, while a change to druid.sql.dialect.sqlserver.visitor can't break druid.
Position
Below the diagonal: druid.sql.dialect.sqlserver.visitor uses a module listed above it, which is the healthy direction.
8→11 druid.sql.dialect.sqlserver.visitor uses druid.sql.dialect.sqlserver.astpart of a loop✕
Connections
5 pairs of types, where a type in druid.sql.dialect.sqlserver.visitor uses a type in druid.sql.dialect.sqlserver.ast.
druid.sql.dialect.sqlserver.visitor uses druid.sql.dialect.sqlserver.ast, so a change to druid.sql.dialect.sqlserver.ast can break druid.sql.dialect.sqlserver.visitor, while a change to druid.sql.dialect.sqlserver.visitor can't break druid.sql.dialect.sqlserver.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
8→18 druid.sql.dialect.sqlserver.visitor uses druid.sql.repositorypart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.sqlserver.visitor uses a type in druid.sql.repository.
druid.sql.dialect.sqlserver.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.dialect.sqlserver.visitor, while a change to druid.sql.dialect.sqlserver.visitor can't break druid.sql.repository.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
8→22 druid.sql.dialect.sqlserver.visitor uses druid.sql.visitorpart of a loop✕
Connections
6 pairs of types, where a type in druid.sql.dialect.sqlserver.visitor uses a type in druid.sql.visitor.
druid.sql.dialect.sqlserver.visitor uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.sqlserver.visitor, while a change to druid.sql.dialect.sqlserver.visitor can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
8→26 druid.sql.dialect.sqlserver.visitor uses druid.sql.ast.statementpart of a loop✕
Connections
18 pairs of types, where a type in druid.sql.dialect.sqlserver.visitor uses a type in druid.sql.ast.statement.
druid.sql.dialect.sqlserver.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.sqlserver.visitor, while a change to druid.sql.dialect.sqlserver.visitor can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
8→27 druid.sql.dialect.sqlserver.visitor uses druid.sql.ast.exprpart of a loop✕
Connections
16 pairs of types, where a type in druid.sql.dialect.sqlserver.visitor uses a type in druid.sql.ast.expr.
druid.sql.dialect.sqlserver.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.sqlserver.visitor, while a change to druid.sql.dialect.sqlserver.visitor can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
8→28 druid.sql.dialect.sqlserver.visitor uses druid.sql.astpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.sqlserver.visitor uses a type in druid.sql.ast.
druid.sql.dialect.sqlserver.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.sqlserver.visitor, while a change to druid.sql.dialect.sqlserver.visitor can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
8→29 druid.sql.dialect.sqlserver.visitor uses druid.sqlpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.sqlserver.visitor uses a type in druid.sql.
druid.sql.dialect.sqlserver.visitor uses druid.sql, so a change to druid.sql can break druid.sql.dialect.sqlserver.visitor, while a change to druid.sql.dialect.sqlserver.visitor can't break druid.sql.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.odps.visitor uses druid.sql.dialect.hive.stmt, so a change to druid.sql.dialect.hive.stmt can break druid.sql.dialect.odps.visitor, while a change to druid.sql.dialect.odps.visitor can't break druid.sql.dialect.hive.stmt.
Position
Below the diagonal: druid.sql.dialect.odps.visitor uses a module listed above it, which is the healthy direction.
9→12 druid.sql.dialect.odps.visitor uses druid.sql.dialect.odps.astpart of a loop✕
Connections
79 pairs of types, where a type in druid.sql.dialect.odps.visitor uses a type in druid.sql.dialect.odps.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.odps.visitor uses druid.sql.dialect.odps.ast, so a change to druid.sql.dialect.odps.ast can break druid.sql.dialect.odps.visitor, while a change to druid.sql.dialect.odps.visitor can't break druid.sql.dialect.odps.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
9→18 druid.sql.dialect.odps.visitor uses druid.sql.repositorypart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.odps.visitor uses a type in druid.sql.repository.
druid.sql.dialect.odps.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.dialect.odps.visitor, while a change to druid.sql.dialect.odps.visitor can't break druid.sql.repository.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
9→19 druid.sql.dialect.odps.visitor uses druid.sql.dialect.hive.visitorpart of a loop✕
Connections
4 pairs of types, where a type in druid.sql.dialect.odps.visitor uses a type in druid.sql.dialect.hive.visitor.
druid.sql.dialect.odps.visitor uses druid.sql.dialect.hive.visitor, so a change to druid.sql.dialect.hive.visitor can break druid.sql.dialect.odps.visitor, while a change to druid.sql.dialect.odps.visitor can't break druid.sql.dialect.hive.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
9→26 druid.sql.dialect.odps.visitor uses druid.sql.ast.statementpart of a loop✕
Connections
11 pairs of types, where a type in druid.sql.dialect.odps.visitor uses a type in druid.sql.ast.statement.
druid.sql.dialect.odps.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.odps.visitor, while a change to druid.sql.dialect.odps.visitor can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
9→27 druid.sql.dialect.odps.visitor uses druid.sql.ast.exprpart of a loop✕
Connections
7 pairs of types, where a type in druid.sql.dialect.odps.visitor uses a type in druid.sql.ast.expr.
druid.sql.dialect.odps.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.odps.visitor, while a change to druid.sql.dialect.odps.visitor can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
9→28 druid.sql.dialect.odps.visitor uses druid.sql.astpart of a loop✕
Connections
5 pairs of types, where a type in druid.sql.dialect.odps.visitor uses a type in druid.sql.ast.
druid.sql.dialect.odps.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.odps.visitor, while a change to druid.sql.dialect.odps.visitor can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.oracle.ast.clause uses druid.sql.dialect.oracle.ast.expr, so a change to druid.sql.dialect.oracle.ast.expr can break druid.sql.dialect.oracle.ast.clause, while a change to druid.sql.dialect.oracle.ast.clause can't break druid.sql.dialect.oracle.ast.expr.
Position
Below the diagonal: druid.sql.dialect.oracle.ast.clause uses a module listed above it, which is the healthy direction.
10→13 druid.sql.dialect.oracle.ast.clause uses druid.sql.dialect.oracle.visitorpart of a loop✕
Connections
18 pairs of types, where a type in druid.sql.dialect.oracle.ast.clause uses a type in druid.sql.dialect.oracle.visitor.
druid.sql.dialect.oracle.ast.clause uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.dialect.oracle.ast.clause, while a change to druid.sql.dialect.oracle.ast.clause can't break druid.sql.dialect.oracle.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
10→14 druid.sql.dialect.oracle.ast.clause uses druid.sql.dialect.oracle.astpart of a loop✕
Connections
18 pairs of types, where a type in druid.sql.dialect.oracle.ast.clause uses a type in druid.sql.dialect.oracle.ast.
druid.sql.dialect.oracle.ast.clause uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.dialect.oracle.ast.clause, while a change to druid.sql.dialect.oracle.ast.clause can't break druid.sql.dialect.oracle.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
10→22 druid.sql.dialect.oracle.ast.clause uses druid.sql.visitorpart of a loop✕
Connections
3 pairs of types, where a type in druid.sql.dialect.oracle.ast.clause uses a type in druid.sql.visitor.
druid.sql.dialect.oracle.ast.clause uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.oracle.ast.clause, while a change to druid.sql.dialect.oracle.ast.clause can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
10→26 druid.sql.dialect.oracle.ast.clause uses druid.sql.ast.statementpart of a loop✕
Connections
3 pairs of types, where a type in druid.sql.dialect.oracle.ast.clause uses a type in druid.sql.ast.statement.
druid.sql.dialect.oracle.ast.clause uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.oracle.ast.clause, while a change to druid.sql.dialect.oracle.ast.clause can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
10→27 druid.sql.dialect.oracle.ast.clause uses druid.sql.ast.exprpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.oracle.ast.clause uses a type in druid.sql.ast.expr.
druid.sql.dialect.oracle.ast.clause uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.oracle.ast.clause, while a change to druid.sql.dialect.oracle.ast.clause can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
10→28 druid.sql.dialect.oracle.ast.clause uses druid.sql.astpart of a loop✕
Connections
20 pairs of types, where a type in druid.sql.dialect.oracle.ast.clause uses a type in druid.sql.ast.
druid.sql.dialect.oracle.ast.clause uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.oracle.ast.clause, while a change to druid.sql.dialect.oracle.ast.clause can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.sqlserver.ast uses druid.sql.dialect.sqlserver.visitor, so a change to druid.sql.dialect.sqlserver.visitor can break druid.sql.dialect.sqlserver.ast, while a change to druid.sql.dialect.sqlserver.ast can't break druid.sql.dialect.sqlserver.visitor.
Position
Below the diagonal: druid.sql.dialect.sqlserver.ast uses a module listed above it, which is the healthy direction.
11→22 druid.sql.dialect.sqlserver.ast uses druid.sql.visitorpart of a loop✕
Connections
4 pairs of types, where a type in druid.sql.dialect.sqlserver.ast uses a type in druid.sql.visitor.
druid.sql.dialect.sqlserver.ast uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.sqlserver.ast, while a change to druid.sql.dialect.sqlserver.ast can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
11→26 druid.sql.dialect.sqlserver.ast uses druid.sql.ast.statementpart of a loop✕
Connections
4 pairs of types, where a type in druid.sql.dialect.sqlserver.ast uses a type in druid.sql.ast.statement.
druid.sql.dialect.sqlserver.ast uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.sqlserver.ast, while a change to druid.sql.dialect.sqlserver.ast can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
11→28 druid.sql.dialect.sqlserver.ast uses druid.sql.astpart of a loop✕
Connections
5 pairs of types, where a type in druid.sql.dialect.sqlserver.ast uses a type in druid.sql.ast.
druid.sql.dialect.sqlserver.ast uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.sqlserver.ast, while a change to druid.sql.dialect.sqlserver.ast can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.odps.ast uses druid.sql.dialect.hive.stmt, so a change to druid.sql.dialect.hive.stmt can break druid.sql.dialect.odps.ast, while a change to druid.sql.dialect.odps.ast can't break druid.sql.dialect.hive.stmt.
Position
Below the diagonal: druid.sql.dialect.odps.ast uses a module listed above it, which is the healthy direction.
41 pairs of types, where a type in druid.sql.dialect.odps.ast uses a type in druid.sql.dialect.odps.visitor. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.odps.ast uses druid.sql.dialect.odps.visitor, so a change to druid.sql.dialect.odps.visitor can break druid.sql.dialect.odps.ast, while a change to druid.sql.dialect.odps.ast can't break druid.sql.dialect.odps.visitor.
Position
Below the diagonal: druid.sql.dialect.odps.ast uses a module listed above it, which is the healthy direction.
12→22 druid.sql.dialect.odps.ast uses druid.sql.visitorpart of a loop✕
Connections
17 pairs of types, where a type in druid.sql.dialect.odps.ast uses a type in druid.sql.visitor.
druid.sql.dialect.odps.ast uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.odps.ast, while a change to druid.sql.dialect.odps.ast can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
12→26 druid.sql.dialect.odps.ast uses druid.sql.ast.statementpart of a loop✕
Connections
38 pairs of types, where a type in druid.sql.dialect.odps.ast uses a type in druid.sql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.odps.ast uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.odps.ast, while a change to druid.sql.dialect.odps.ast can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
12→27 druid.sql.dialect.odps.ast uses druid.sql.ast.exprpart of a loop✕
Connections
3 pairs of types, where a type in druid.sql.dialect.odps.ast uses a type in druid.sql.ast.expr.
druid.sql.dialect.odps.ast uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.odps.ast, while a change to druid.sql.dialect.odps.ast can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
12→28 druid.sql.dialect.odps.ast uses druid.sql.astpart of a loop✕
Connections
48 pairs of types, where a type in druid.sql.dialect.odps.ast uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.odps.ast uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.odps.ast, while a change to druid.sql.dialect.odps.ast can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
29 pairs of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.dialect.oracle.ast.expr. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oracle.visitor uses druid.sql.dialect.oracle.ast.expr, so a change to druid.sql.dialect.oracle.ast.expr can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.dialect.oracle.ast.expr.
Position
Below the diagonal: druid.sql.dialect.oracle.visitor uses a module listed above it, which is the healthy direction.
37 pairs of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.dialect.oracle.ast.clause. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oracle.visitor uses druid.sql.dialect.oracle.ast.clause, so a change to druid.sql.dialect.oracle.ast.clause can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.dialect.oracle.ast.clause.
Position
Below the diagonal: druid.sql.dialect.oracle.visitor uses a module listed above it, which is the healthy direction.
13→14 druid.sql.dialect.oracle.visitor uses druid.sql.dialect.oracle.astpart of a loop✕
Connections
7 pairs of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.dialect.oracle.ast.
druid.sql.dialect.oracle.visitor uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.dialect.oracle.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
13→15 druid.sql.dialect.oracle.visitor uses druid.sql.dialect.oracle.ast.stmtpart of a loop✕
Connections
177 pairs of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.dialect.oracle.ast.stmt. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oracle.visitor uses druid.sql.dialect.oracle.ast.stmt, so a change to druid.sql.dialect.oracle.ast.stmt can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.dialect.oracle.ast.stmt.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
13→18 druid.sql.dialect.oracle.visitor uses druid.sql.repositorypart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.repository.
druid.sql.dialect.oracle.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.repository.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
13→22 druid.sql.dialect.oracle.visitor uses druid.sql.visitorpart of a loop✕
Connections
8 pairs of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.visitor.
druid.sql.dialect.oracle.visitor uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
13→26 druid.sql.dialect.oracle.visitor uses druid.sql.ast.statementpart of a loop✕
Connections
25 pairs of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.ast.statement.
druid.sql.dialect.oracle.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
13→27 druid.sql.dialect.oracle.visitor uses druid.sql.ast.exprpart of a loop✕
Connections
22 pairs of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.ast.expr.
druid.sql.dialect.oracle.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
13→28 druid.sql.dialect.oracle.visitor uses druid.sql.astpart of a loop✕
Connections
11 pairs of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.sql.ast.
druid.sql.dialect.oracle.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
13→35 druid.sql.dialect.oracle.visitor uses druid.statpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.oracle.visitor uses a type in druid.stat.
druid.sql.dialect.oracle.visitor uses druid.stat, so a change to druid.stat can break druid.sql.dialect.oracle.visitor, while a change to druid.sql.dialect.oracle.visitor can't break druid.stat.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.oracle.ast uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.dialect.oracle.ast, while a change to druid.sql.dialect.oracle.ast can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.sql.dialect.oracle.ast uses a module listed above it, which is the healthy direction.
14→22 druid.sql.dialect.oracle.ast uses druid.sql.visitorpart of a loop✕
Connections
4 pairs of types, where a type in druid.sql.dialect.oracle.ast uses a type in druid.sql.visitor.
druid.sql.dialect.oracle.ast uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.oracle.ast, while a change to druid.sql.dialect.oracle.ast can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
14→28 druid.sql.dialect.oracle.ast uses druid.sql.astpart of a loop✕
Connections
14 pairs of types, where a type in druid.sql.dialect.oracle.ast uses a type in druid.sql.ast.
druid.sql.dialect.oracle.ast uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.oracle.ast, while a change to druid.sql.dialect.oracle.ast can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.oracle.ast.stmt uses druid.sql.dialect.oracle.ast.clause, so a change to druid.sql.dialect.oracle.ast.clause can break druid.sql.dialect.oracle.ast.stmt, while a change to druid.sql.dialect.oracle.ast.stmt can't break druid.sql.dialect.oracle.ast.clause.
Position
Below the diagonal: druid.sql.dialect.oracle.ast.stmt uses a module listed above it, which is the healthy direction.
66 pairs of types, where a type in druid.sql.dialect.oracle.ast.stmt uses a type in druid.sql.dialect.oracle.visitor. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oracle.ast.stmt uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.dialect.oracle.ast.stmt, while a change to druid.sql.dialect.oracle.ast.stmt can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.sql.dialect.oracle.ast.stmt uses a module listed above it, which is the healthy direction.
34 pairs of types, where a type in druid.sql.dialect.oracle.ast.stmt uses a type in druid.sql.dialect.oracle.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oracle.ast.stmt uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.dialect.oracle.ast.stmt, while a change to druid.sql.dialect.oracle.ast.stmt can't break druid.sql.dialect.oracle.ast.
Position
Below the diagonal: druid.sql.dialect.oracle.ast.stmt uses a module listed above it, which is the healthy direction.
15→22 druid.sql.dialect.oracle.ast.stmt uses druid.sql.visitorpart of a loop✕
Connections
22 pairs of types, where a type in druid.sql.dialect.oracle.ast.stmt uses a type in druid.sql.visitor.
druid.sql.dialect.oracle.ast.stmt uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.oracle.ast.stmt, while a change to druid.sql.dialect.oracle.ast.stmt can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
15→26 druid.sql.dialect.oracle.ast.stmt uses druid.sql.ast.statementpart of a loop✕
Connections
49 pairs of types, where a type in druid.sql.dialect.oracle.ast.stmt uses a type in druid.sql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oracle.ast.stmt uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.oracle.ast.stmt, while a change to druid.sql.dialect.oracle.ast.stmt can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
15→28 druid.sql.dialect.oracle.ast.stmt uses druid.sql.astpart of a loop✕
Connections
79 pairs of types, where a type in druid.sql.dialect.oracle.ast.stmt uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oracle.ast.stmt uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.oracle.ast.stmt, while a change to druid.sql.dialect.oracle.ast.stmt can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.postgresql.visitor uses druid, so a change to druid can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.
Position
Below the diagonal: druid.sql.dialect.postgresql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.postgresql.visitor uses druid.sql.dialect.oracle.ast.expr, so a change to druid.sql.dialect.oracle.ast.expr can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.dialect.oracle.ast.expr.
Position
Below the diagonal: druid.sql.dialect.postgresql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.postgresql.visitor uses druid.sql.dialect.oracle.ast.clause, so a change to druid.sql.dialect.oracle.ast.clause can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.dialect.oracle.ast.clause.
Position
Below the diagonal: druid.sql.dialect.postgresql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.postgresql.visitor uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.sql.dialect.postgresql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.postgresql.visitor uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.dialect.oracle.ast.
Position
Below the diagonal: druid.sql.dialect.postgresql.visitor uses a module listed above it, which is the healthy direction.
58 pairs of types, where a type in druid.sql.dialect.postgresql.visitor uses a type in druid.sql.dialect.oracle.ast.stmt. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.postgresql.visitor uses druid.sql.dialect.oracle.ast.stmt, so a change to druid.sql.dialect.oracle.ast.stmt can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.dialect.oracle.ast.stmt.
Position
Below the diagonal: druid.sql.dialect.postgresql.visitor uses a module listed above it, which is the healthy direction.
16→17 druid.sql.dialect.postgresql.visitor uses druid.sql.dialect.postgresql.ast.stmtpart of a loop✕
Connections
70 pairs of types, where a type in druid.sql.dialect.postgresql.visitor uses a type in druid.sql.dialect.postgresql.ast.stmt. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.postgresql.visitor uses druid.sql.dialect.postgresql.ast.stmt, so a change to druid.sql.dialect.postgresql.ast.stmt can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.dialect.postgresql.ast.stmt.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
16→18 druid.sql.dialect.postgresql.visitor uses druid.sql.repositorypart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.postgresql.visitor uses a type in druid.sql.repository.
druid.sql.dialect.postgresql.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.repository.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
16→22 druid.sql.dialect.postgresql.visitor uses druid.sql.visitorpart of a loop✕
Connections
6 pairs of types, where a type in druid.sql.dialect.postgresql.visitor uses a type in druid.sql.visitor.
druid.sql.dialect.postgresql.visitor uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
16→26 druid.sql.dialect.postgresql.visitor uses druid.sql.ast.statementpart of a loop✕
Connections
20 pairs of types, where a type in druid.sql.dialect.postgresql.visitor uses a type in druid.sql.ast.statement.
druid.sql.dialect.postgresql.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
16→27 druid.sql.dialect.postgresql.visitor uses druid.sql.ast.exprpart of a loop✕
Connections
20 pairs of types, where a type in druid.sql.dialect.postgresql.visitor uses a type in druid.sql.ast.expr.
druid.sql.dialect.postgresql.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
16→28 druid.sql.dialect.postgresql.visitor uses druid.sql.astpart of a loop✕
Connections
7 pairs of types, where a type in druid.sql.dialect.postgresql.visitor uses a type in druid.sql.ast.
druid.sql.dialect.postgresql.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
16→29 druid.sql.dialect.postgresql.visitor uses druid.sqlpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.postgresql.visitor uses a type in druid.sql.
druid.sql.dialect.postgresql.visitor uses druid.sql, so a change to druid.sql can break druid.sql.dialect.postgresql.visitor, while a change to druid.sql.dialect.postgresql.visitor can't break druid.sql.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.postgresql.ast.stmt uses druid, so a change to druid can break druid.sql.dialect.postgresql.ast.stmt, while a change to druid.sql.dialect.postgresql.ast.stmt can't break druid.
Position
Below the diagonal: druid.sql.dialect.postgresql.ast.stmt uses a module listed above it, which is the healthy direction.
druid.sql.dialect.postgresql.ast.stmt uses druid.sql.dialect.postgresql.visitor, so a change to druid.sql.dialect.postgresql.visitor can break druid.sql.dialect.postgresql.ast.stmt, while a change to druid.sql.dialect.postgresql.ast.stmt can't break druid.sql.dialect.postgresql.visitor.
Position
Below the diagonal: druid.sql.dialect.postgresql.ast.stmt uses a module listed above it, which is the healthy direction.
17→22 druid.sql.dialect.postgresql.ast.stmt uses druid.sql.visitorpart of a loop✕
Connections
21 pairs of types, where a type in druid.sql.dialect.postgresql.ast.stmt uses a type in druid.sql.visitor.
druid.sql.dialect.postgresql.ast.stmt uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.postgresql.ast.stmt, while a change to druid.sql.dialect.postgresql.ast.stmt can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
17→26 druid.sql.dialect.postgresql.ast.stmt uses druid.sql.ast.statementpart of a loop✕
Connections
22 pairs of types, where a type in druid.sql.dialect.postgresql.ast.stmt uses a type in druid.sql.ast.statement.
druid.sql.dialect.postgresql.ast.stmt uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.postgresql.ast.stmt, while a change to druid.sql.dialect.postgresql.ast.stmt can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
17→27 druid.sql.dialect.postgresql.ast.stmt uses druid.sql.ast.exprpart of a loop✕
Connections
3 pairs of types, where a type in druid.sql.dialect.postgresql.ast.stmt uses a type in druid.sql.ast.expr.
druid.sql.dialect.postgresql.ast.stmt uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.postgresql.ast.stmt, while a change to druid.sql.dialect.postgresql.ast.stmt can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
17→28 druid.sql.dialect.postgresql.ast.stmt uses druid.sql.astpart of a loop✕
Connections
35 pairs of types, where a type in druid.sql.dialect.postgresql.ast.stmt uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.postgresql.ast.stmt uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.postgresql.ast.stmt, while a change to druid.sql.dialect.postgresql.ast.stmt can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.repository uses druid.support.logging, so a change to druid.support.logging can break druid.sql.repository, while a change to druid.sql.repository can't break druid.support.logging.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.db2.visitor, so a change to druid.sql.dialect.db2.visitor can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.db2.visitor.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.mysql.ast.statement, so a change to druid.sql.dialect.mysql.ast.statement can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.mysql.ast.statement.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.sqlserver.visitor, so a change to druid.sql.dialect.sqlserver.visitor can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.sqlserver.visitor.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.odps.visitor, so a change to druid.sql.dialect.odps.visitor can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.odps.visitor.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.sqlserver.ast, so a change to druid.sql.dialect.sqlserver.ast can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.sqlserver.ast.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.odps.ast, so a change to druid.sql.dialect.odps.ast can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.odps.ast.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.oracle.ast.stmt, so a change to druid.sql.dialect.oracle.ast.stmt can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.oracle.ast.stmt.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.postgresql.visitor, so a change to druid.sql.dialect.postgresql.visitor can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.postgresql.visitor.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
druid.sql.repository uses druid.sql.dialect.postgresql.ast.stmt, so a change to druid.sql.dialect.postgresql.ast.stmt can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.postgresql.ast.stmt.
Position
Below the diagonal: druid.sql.repository uses a module listed above it, which is the healthy direction.
18→19 druid.sql.repository uses druid.sql.dialect.hive.visitorpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.repository uses a type in druid.sql.dialect.hive.visitor.
druid.sql.repository uses druid.sql.dialect.hive.visitor, so a change to druid.sql.dialect.hive.visitor can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.hive.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→20 druid.sql.repository uses druid.sql.dialect.hive.astpart of a loop✕
Connections
3 pairs of types, where a type in druid.sql.repository uses a type in druid.sql.dialect.hive.ast.
druid.sql.repository uses druid.sql.dialect.hive.ast, so a change to druid.sql.dialect.hive.ast can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.hive.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→22 druid.sql.repository uses druid.sql.visitorpart of a loop✕
Connections
4 pairs of types, where a type in druid.sql.repository uses a type in druid.sql.visitor.
druid.sql.repository uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→24 druid.sql.repository uses druid.sql.dialect.mysql.visitorpart of a loop✕
Connections
2 pairs of types, where a type in druid.sql.repository uses a type in druid.sql.dialect.mysql.visitor.
druid.sql.repository uses druid.sql.dialect.mysql.visitor, so a change to druid.sql.dialect.mysql.visitor can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.mysql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→25 druid.sql.repository uses druid.sql.dialect.mysql.astpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.repository uses a type in druid.sql.dialect.mysql.ast.
druid.sql.repository uses druid.sql.dialect.mysql.ast, so a change to druid.sql.dialect.mysql.ast can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.dialect.mysql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→26 druid.sql.repository uses druid.sql.ast.statementpart of a loop✕
Connections
114 pairs of types, where a type in druid.sql.repository uses a type in druid.sql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.repository uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→27 druid.sql.repository uses druid.sql.ast.exprpart of a loop✕
Connections
14 pairs of types, where a type in druid.sql.repository uses a type in druid.sql.ast.expr.
druid.sql.repository uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→28 druid.sql.repository uses druid.sql.astpart of a loop✕
Connections
24 pairs of types, where a type in druid.sql.repository uses a type in druid.sql.ast.
druid.sql.repository uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.repository, while a change to druid.sql.repository can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.hive.visitor uses druid, so a change to druid can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.
Position
Below the diagonal: druid.sql.dialect.hive.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.hive.visitor uses druid.sql.dialect.hive.stmt, so a change to druid.sql.dialect.hive.stmt can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.sql.dialect.hive.stmt.
Position
Below the diagonal: druid.sql.dialect.hive.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.hive.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.sql.repository.
Position
Below the diagonal: druid.sql.dialect.hive.visitor uses a module listed above it, which is the healthy direction.
19→20 druid.sql.dialect.hive.visitor uses druid.sql.dialect.hive.astpart of a loop✕
Connections
11 pairs of types, where a type in druid.sql.dialect.hive.visitor uses a type in druid.sql.dialect.hive.ast.
druid.sql.dialect.hive.visitor uses druid.sql.dialect.hive.ast, so a change to druid.sql.dialect.hive.ast can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.sql.dialect.hive.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→22 druid.sql.dialect.hive.visitor uses druid.sql.visitorpart of a loop✕
Connections
4 pairs of types, where a type in druid.sql.dialect.hive.visitor uses a type in druid.sql.visitor.
druid.sql.dialect.hive.visitor uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→26 druid.sql.dialect.hive.visitor uses druid.sql.ast.statementpart of a loop✕
Connections
5 pairs of types, where a type in druid.sql.dialect.hive.visitor uses a type in druid.sql.ast.statement.
druid.sql.dialect.hive.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→27 druid.sql.dialect.hive.visitor uses druid.sql.ast.exprpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.hive.visitor uses a type in druid.sql.ast.expr.
druid.sql.dialect.hive.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→28 druid.sql.dialect.hive.visitor uses druid.sql.astpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.hive.visitor uses a type in druid.sql.ast.
druid.sql.dialect.hive.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→29 druid.sql.dialect.hive.visitor uses druid.sqlpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.hive.visitor uses a type in druid.sql.
druid.sql.dialect.hive.visitor uses druid.sql, so a change to druid.sql can break druid.sql.dialect.hive.visitor, while a change to druid.sql.dialect.hive.visitor can't break druid.sql.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.hive.ast uses druid.sql.dialect.odps.visitor, so a change to druid.sql.dialect.odps.visitor can break druid.sql.dialect.hive.ast, while a change to druid.sql.dialect.hive.ast can't break druid.sql.dialect.odps.visitor.
Position
Below the diagonal: druid.sql.dialect.hive.ast uses a module listed above it, which is the healthy direction.
druid.sql.dialect.hive.ast uses druid.sql.dialect.hive.visitor, so a change to druid.sql.dialect.hive.visitor can break druid.sql.dialect.hive.ast, while a change to druid.sql.dialect.hive.ast can't break druid.sql.dialect.hive.visitor.
Position
Below the diagonal: druid.sql.dialect.hive.ast uses a module listed above it, which is the healthy direction.
20→22 druid.sql.dialect.hive.ast uses druid.sql.visitorpart of a loop✕
Connections
5 pairs of types, where a type in druid.sql.dialect.hive.ast uses a type in druid.sql.visitor.
druid.sql.dialect.hive.ast uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.hive.ast, while a change to druid.sql.dialect.hive.ast can't break druid.sql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→26 druid.sql.dialect.hive.ast uses druid.sql.ast.statementpart of a loop✕
Connections
8 pairs of types, where a type in druid.sql.dialect.hive.ast uses a type in druid.sql.ast.statement.
druid.sql.dialect.hive.ast uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.hive.ast, while a change to druid.sql.dialect.hive.ast can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→28 druid.sql.dialect.hive.ast uses druid.sql.astpart of a loop✕
Connections
7 pairs of types, where a type in druid.sql.dialect.hive.ast uses a type in druid.sql.ast.
druid.sql.dialect.hive.ast uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.hive.ast, while a change to druid.sql.dialect.hive.ast can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.parser uses druid.support.logging, so a change to druid.support.logging can break druid.sql.parser, while a change to druid.sql.parser can't break druid.support.logging.
Position
Below the diagonal: druid.sql.parser uses a module listed above it, which is the healthy direction.
druid.sql.parser uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.parser, while a change to druid.sql.parser can't break druid.sql.repository.
Position
Below the diagonal: druid.sql.parser uses a module listed above it, which is the healthy direction.
druid.sql.parser uses druid.sql.dialect.hive.ast, so a change to druid.sql.dialect.hive.ast can break druid.sql.parser, while a change to druid.sql.parser can't break druid.sql.dialect.hive.ast.
Position
Below the diagonal: druid.sql.parser uses a module listed above it, which is the healthy direction.
21→25 druid.sql.parser uses druid.sql.dialect.mysql.astpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.parser uses a type in druid.sql.dialect.mysql.ast.
druid.sql.parser uses druid.sql.dialect.mysql.ast, so a change to druid.sql.dialect.mysql.ast can break druid.sql.parser, while a change to druid.sql.parser can't break druid.sql.dialect.mysql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
21→26 druid.sql.parser uses druid.sql.ast.statementpart of a loop✕
Connections
97 pairs of types, where a type in druid.sql.parser uses a type in druid.sql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.parser uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.parser, while a change to druid.sql.parser can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
21→27 druid.sql.parser uses druid.sql.ast.exprpart of a loop✕
Connections
11 pairs of types, where a type in druid.sql.parser uses a type in druid.sql.ast.expr.
druid.sql.parser uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.parser, while a change to druid.sql.parser can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
21→28 druid.sql.parser uses druid.sql.astpart of a loop✕
Connections
38 pairs of types, where a type in druid.sql.parser uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.parser uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.parser, while a change to druid.sql.parser can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.visitor uses druid.sql.dialect.mysql.ast.statement, so a change to druid.sql.dialect.mysql.ast.statement can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.mysql.ast.statement.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.dialect.oracle.ast.expr, so a change to druid.sql.dialect.oracle.ast.expr can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.oracle.ast.expr.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.dialect.odps.visitor, so a change to druid.sql.dialect.odps.visitor can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.odps.visitor.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.dialect.odps.ast, so a change to druid.sql.dialect.odps.ast can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.odps.ast.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.oracle.ast.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.dialect.postgresql.visitor, so a change to druid.sql.dialect.postgresql.visitor can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.postgresql.visitor.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.repository.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.dialect.hive.ast, so a change to druid.sql.dialect.hive.ast can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.hive.ast.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.visitor uses druid.sql.parser, so a change to druid.sql.parser can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.parser.
Position
Below the diagonal: druid.sql.visitor uses a module listed above it, which is the healthy direction.
22→24 druid.sql.visitor uses druid.sql.dialect.mysql.visitorpart of a loop✕
Connections
2 pairs of types, where a type in druid.sql.visitor uses a type in druid.sql.dialect.mysql.visitor.
druid.sql.visitor uses druid.sql.dialect.mysql.visitor, so a change to druid.sql.dialect.mysql.visitor can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.mysql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→25 druid.sql.visitor uses druid.sql.dialect.mysql.astpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.visitor uses a type in druid.sql.dialect.mysql.ast.
druid.sql.visitor uses druid.sql.dialect.mysql.ast, so a change to druid.sql.dialect.mysql.ast can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.dialect.mysql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→26 druid.sql.visitor uses druid.sql.ast.statementpart of a loop✕
Connections
677 pairs of types, where a type in druid.sql.visitor uses a type in druid.sql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→27 druid.sql.visitor uses druid.sql.ast.exprpart of a loop✕
Connections
198 pairs of types, where a type in druid.sql.visitor uses a type in druid.sql.ast.expr. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→28 druid.sql.visitor uses druid.sql.astpart of a loop✕
Connections
123 pairs of types, where a type in druid.sql.visitor uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.visitor, while a change to druid.sql.visitor can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→29 druid.sql.visitor uses druid.sqlpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.visitor uses a type in druid.sql.
druid.sql.dialect.mysql.ast.expr uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.mysql.ast.expr, while a change to druid.sql.dialect.mysql.ast.expr can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.dialect.mysql.ast.expr uses a module listed above it, which is the healthy direction.
23→24 druid.sql.dialect.mysql.ast.expr uses druid.sql.dialect.mysql.visitorpart of a loop✕
Connections
6 pairs of types, where a type in druid.sql.dialect.mysql.ast.expr uses a type in druid.sql.dialect.mysql.visitor.
druid.sql.dialect.mysql.ast.expr uses druid.sql.dialect.mysql.visitor, so a change to druid.sql.dialect.mysql.visitor can break druid.sql.dialect.mysql.ast.expr, while a change to druid.sql.dialect.mysql.ast.expr can't break druid.sql.dialect.mysql.visitor.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→25 druid.sql.dialect.mysql.ast.expr uses druid.sql.dialect.mysql.astpart of a loop✕
Connections
3 pairs of types, where a type in druid.sql.dialect.mysql.ast.expr uses a type in druid.sql.dialect.mysql.ast.
druid.sql.dialect.mysql.ast.expr uses druid.sql.dialect.mysql.ast, so a change to druid.sql.dialect.mysql.ast can break druid.sql.dialect.mysql.ast.expr, while a change to druid.sql.dialect.mysql.ast.expr can't break druid.sql.dialect.mysql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→26 druid.sql.dialect.mysql.ast.expr uses druid.sql.ast.statementpart of a loop✕
Connections
1 pair of types, where a type in druid.sql.dialect.mysql.ast.expr uses a type in druid.sql.ast.statement.
druid.sql.dialect.mysql.ast.expr uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.mysql.ast.expr, while a change to druid.sql.dialect.mysql.ast.expr can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→27 druid.sql.dialect.mysql.ast.expr uses druid.sql.ast.exprpart of a loop✕
Connections
2 pairs of types, where a type in druid.sql.dialect.mysql.ast.expr uses a type in druid.sql.ast.expr.
druid.sql.dialect.mysql.ast.expr uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.mysql.ast.expr, while a change to druid.sql.dialect.mysql.ast.expr can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→28 druid.sql.dialect.mysql.ast.expr uses druid.sql.astpart of a loop✕
Connections
14 pairs of types, where a type in druid.sql.dialect.mysql.ast.expr uses a type in druid.sql.ast.
druid.sql.dialect.mysql.ast.expr uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.mysql.ast.expr, while a change to druid.sql.dialect.mysql.ast.expr can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.mysql.visitor uses druid, so a change to druid can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.
Position
Below the diagonal: druid.sql.dialect.mysql.visitor uses a module listed above it, which is the healthy direction.
433 pairs of types, where a type in druid.sql.dialect.mysql.visitor uses a type in druid.sql.dialect.mysql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.mysql.visitor uses druid.sql.dialect.mysql.ast.statement, so a change to druid.sql.dialect.mysql.ast.statement can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.sql.dialect.mysql.ast.statement.
Position
Below the diagonal: druid.sql.dialect.mysql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.mysql.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.sql.repository.
Position
Below the diagonal: druid.sql.dialect.mysql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.mysql.visitor uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.dialect.mysql.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.mysql.visitor uses druid.sql.dialect.mysql.ast.expr, so a change to druid.sql.dialect.mysql.ast.expr can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.sql.dialect.mysql.ast.expr.
Position
Below the diagonal: druid.sql.dialect.mysql.visitor uses a module listed above it, which is the healthy direction.
24→25 druid.sql.dialect.mysql.visitor uses druid.sql.dialect.mysql.astpart of a loop✕
Connections
20 pairs of types, where a type in druid.sql.dialect.mysql.visitor uses a type in druid.sql.dialect.mysql.ast.
druid.sql.dialect.mysql.visitor uses druid.sql.dialect.mysql.ast, so a change to druid.sql.dialect.mysql.ast can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.sql.dialect.mysql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
24→26 druid.sql.dialect.mysql.visitor uses druid.sql.ast.statementpart of a loop✕
Connections
40 pairs of types, where a type in druid.sql.dialect.mysql.visitor uses a type in druid.sql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.mysql.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
24→27 druid.sql.dialect.mysql.visitor uses druid.sql.ast.exprpart of a loop✕
Connections
23 pairs of types, where a type in druid.sql.dialect.mysql.visitor uses a type in druid.sql.ast.expr.
druid.sql.dialect.mysql.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
24→28 druid.sql.dialect.mysql.visitor uses druid.sql.astpart of a loop✕
Connections
5 pairs of types, where a type in druid.sql.dialect.mysql.visitor uses a type in druid.sql.ast.
druid.sql.dialect.mysql.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.mysql.visitor, while a change to druid.sql.dialect.mysql.visitor can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.mysql.ast uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.mysql.ast, while a change to druid.sql.dialect.mysql.ast can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.dialect.mysql.ast uses a module listed above it, which is the healthy direction.
druid.sql.dialect.mysql.ast uses druid.sql.dialect.mysql.visitor, so a change to druid.sql.dialect.mysql.visitor can break druid.sql.dialect.mysql.ast, while a change to druid.sql.dialect.mysql.ast can't break druid.sql.dialect.mysql.visitor.
Position
Below the diagonal: druid.sql.dialect.mysql.ast uses a module listed above it, which is the healthy direction.
25→26 druid.sql.dialect.mysql.ast uses druid.sql.ast.statementpart of a loop✕
Connections
7 pairs of types, where a type in druid.sql.dialect.mysql.ast uses a type in druid.sql.ast.statement.
druid.sql.dialect.mysql.ast uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.mysql.ast, while a change to druid.sql.dialect.mysql.ast can't break druid.sql.ast.statement.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
25→28 druid.sql.dialect.mysql.ast uses druid.sql.astpart of a loop✕
Connections
10 pairs of types, where a type in druid.sql.dialect.mysql.ast uses a type in druid.sql.ast.
druid.sql.dialect.mysql.ast uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.mysql.ast, while a change to druid.sql.dialect.mysql.ast can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
66 pairs of types, where a type in druid.sql.ast.statement uses a type in druid. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.ast.statement uses druid, so a change to druid can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.
Position
Below the diagonal: druid.sql.ast.statement uses a module listed above it, which is the healthy direction.
druid.sql.ast.statement uses druid.sql.dialect.mysql.ast.statement, so a change to druid.sql.dialect.mysql.ast.statement can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.sql.dialect.mysql.ast.statement.
Position
Below the diagonal: druid.sql.ast.statement uses a module listed above it, which is the healthy direction.
druid.sql.ast.statement uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.sql.dialect.oracle.ast.
Position
Below the diagonal: druid.sql.ast.statement uses a module listed above it, which is the healthy direction.
druid.sql.ast.statement uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.sql.repository.
Position
Below the diagonal: druid.sql.ast.statement uses a module listed above it, which is the healthy direction.
275 pairs of types, where a type in druid.sql.ast.statement uses a type in druid.sql.visitor. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.ast.statement uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.ast.statement uses a module listed above it, which is the healthy direction.
druid.sql.ast.statement uses druid.sql.dialect.mysql.visitor, so a change to druid.sql.dialect.mysql.visitor can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.sql.dialect.mysql.visitor.
Position
Below the diagonal: druid.sql.ast.statement uses a module listed above it, which is the healthy direction.
druid.sql.ast.statement uses druid.sql.dialect.mysql.ast, so a change to druid.sql.dialect.mysql.ast can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.sql.dialect.mysql.ast.
Position
Below the diagonal: druid.sql.ast.statement uses a module listed above it, which is the healthy direction.
26→27 druid.sql.ast.statement uses druid.sql.ast.exprpart of a loop✕
Connections
31 pairs of types, where a type in druid.sql.ast.statement uses a type in druid.sql.ast.expr. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.ast.statement uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.sql.ast.expr.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
26→28 druid.sql.ast.statement uses druid.sql.astpart of a loop✕
Connections
796 pairs of types, where a type in druid.sql.ast.statement uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.ast.statement uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.ast.statement, while a change to druid.sql.ast.statement can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.ast.expr uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.ast.expr, while a change to druid.sql.ast.expr can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.sql.ast.expr uses a module listed above it, which is the healthy direction.
63 pairs of types, where a type in druid.sql.ast.expr uses a type in druid.sql.visitor. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.ast.expr uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.ast.expr, while a change to druid.sql.ast.expr can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.ast.expr uses a module listed above it, which is the healthy direction.
druid.sql.ast.expr uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.ast.expr, while a change to druid.sql.ast.expr can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.sql.ast.expr uses a module listed above it, which is the healthy direction.
27→28 druid.sql.ast.expr uses druid.sql.astpart of a loop✕
Connections
199 pairs of types, where a type in druid.sql.ast.expr uses a type in druid.sql.ast. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.ast.expr uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.ast.expr, while a change to druid.sql.ast.expr can't break druid.sql.ast.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.ast uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.ast, while a change to druid.sql.ast can't break druid.sql.dialect.oracle.ast.
Position
Below the diagonal: druid.sql.ast uses a module listed above it, which is the healthy direction.
52 pairs of types, where a type in druid.sql.ast uses a type in druid.sql.visitor. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.ast uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.ast, while a change to druid.sql.ast can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.ast uses a module listed above it, which is the healthy direction.
druid.sql.ast uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.ast, while a change to druid.sql.ast can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.sql.ast uses a module listed above it, which is the healthy direction.
druid.sql.ast uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.ast, while a change to druid.sql.ast can't break druid.sql.ast.expr.
Position
Below the diagonal: druid.sql.ast uses a module listed above it, which is the healthy direction.
druid.sql uses druid.support.logging, so a change to druid.support.logging can break druid.sql, while a change to druid.sql can't break druid.support.logging.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.mysql.ast.statement, so a change to druid.sql.dialect.mysql.ast.statement can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.mysql.ast.statement.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.odps.visitor, so a change to druid.sql.dialect.odps.visitor can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.odps.visitor.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.oracle.ast.clause, so a change to druid.sql.dialect.oracle.ast.clause can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.oracle.ast.clause.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.odps.ast, so a change to druid.sql.dialect.odps.ast can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.odps.ast.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.oracle.ast.stmt, so a change to druid.sql.dialect.oracle.ast.stmt can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.oracle.ast.stmt.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql, while a change to druid.sql can't break druid.sql.repository.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.hive.visitor, so a change to druid.sql.dialect.hive.visitor can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.hive.visitor.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.hive.ast, so a change to druid.sql.dialect.hive.ast can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.hive.ast.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql uses druid.sql.dialect.mysql.visitor, so a change to druid.sql.dialect.mysql.visitor can break druid.sql, while a change to druid.sql can't break druid.sql.dialect.mysql.visitor.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
59 pairs of types, where a type in druid.sql uses a type in druid.sql.ast.statement. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql, while a change to druid.sql can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.sql uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.dialect.oracle.ast.expr, so a change to druid.sql.dialect.oracle.ast.expr can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.dialect.oracle.ast.expr.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.dialect.oracle.ast.clause, so a change to druid.sql.dialect.oracle.ast.clause can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.dialect.oracle.ast.clause.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.dialect.oracle.ast, so a change to druid.sql.dialect.oracle.ast can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.dialect.oracle.ast.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
58 pairs of types, where a type in druid.sql.dialect.oscar.visitor uses a type in druid.sql.dialect.oracle.ast.stmt. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.sql.dialect.oscar.visitor uses druid.sql.dialect.oracle.ast.stmt, so a change to druid.sql.dialect.oracle.ast.stmt can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.dialect.oracle.ast.stmt.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.parser, so a change to druid.sql.parser can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.parser.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.ast.expr.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.oscar.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.oscar.visitor, while a change to druid.sql.dialect.oscar.visitor can't break druid.sql.ast.
Position
Below the diagonal: druid.sql.dialect.oscar.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.visitor uses druid, so a change to druid can break druid.sql.dialect.presto.visitor, while a change to druid.sql.dialect.presto.visitor can't break druid.
Position
Below the diagonal: druid.sql.dialect.presto.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.visitor uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.presto.visitor, while a change to druid.sql.dialect.presto.visitor can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.dialect.presto.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.presto.visitor, while a change to druid.sql.dialect.presto.visitor can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.sql.dialect.presto.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.presto.visitor, while a change to druid.sql.dialect.presto.visitor can't break druid.sql.ast.expr.
Position
Below the diagonal: druid.sql.dialect.presto.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.visitor uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.presto.visitor, while a change to druid.sql.dialect.presto.visitor can't break druid.sql.ast.
Position
Below the diagonal: druid.sql.dialect.presto.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.visitor uses druid.sql, so a change to druid.sql can break druid.sql.dialect.presto.visitor, while a change to druid.sql.dialect.presto.visitor can't break druid.sql.
Position
Below the diagonal: druid.sql.dialect.presto.visitor uses a module listed above it, which is the healthy direction.
31→34 druid.sql.dialect.presto.visitor uses druid.sql.dialect.presto.ast.stmtpart of a loop✕
Connections
11 pairs of types, where a type in druid.sql.dialect.presto.visitor uses a type in druid.sql.dialect.presto.ast.stmt.
druid.sql.dialect.presto.visitor uses druid.sql.dialect.presto.ast.stmt, so a change to druid.sql.dialect.presto.ast.stmt can break druid.sql.dialect.presto.visitor, while a change to druid.sql.dialect.presto.visitor can't break druid.sql.dialect.presto.ast.stmt.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.sql.dialect.spark.visitor uses druid, so a change to druid can break druid.sql.dialect.spark.visitor, while a change to druid.sql.dialect.spark.visitor can't break druid.
Position
Below the diagonal: druid.sql.dialect.spark.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.spark.visitor uses druid.sql.repository, so a change to druid.sql.repository can break druid.sql.dialect.spark.visitor, while a change to druid.sql.dialect.spark.visitor can't break druid.sql.repository.
Position
Below the diagonal: druid.sql.dialect.spark.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.spark.visitor uses druid.sql.dialect.hive.visitor, so a change to druid.sql.dialect.hive.visitor can break druid.sql.dialect.spark.visitor, while a change to druid.sql.dialect.spark.visitor can't break druid.sql.dialect.hive.visitor.
Position
Below the diagonal: druid.sql.dialect.spark.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.spark.visitor uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.spark.visitor, while a change to druid.sql.dialect.spark.visitor can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.sql.dialect.spark.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.spark.visitor uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.spark.visitor, while a change to druid.sql.dialect.spark.visitor can't break druid.sql.ast.expr.
Position
Below the diagonal: druid.sql.dialect.spark.visitor uses a module listed above it, which is the healthy direction.
druid.sql.dialect.spark.visitor uses druid.sql, so a change to druid.sql can break druid.sql.dialect.spark.visitor, while a change to druid.sql.dialect.spark.visitor can't break druid.sql.
Position
Below the diagonal: druid.sql.dialect.spark.visitor uses a module listed above it, which is the healthy direction.
druid.util uses druid.support.logging, so a change to druid.support.logging can break druid.util, while a change to druid.util can't break druid.support.logging.
Position
Below the diagonal: druid.util uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.ast.stmt uses druid, so a change to druid can break druid.sql.dialect.presto.ast.stmt, while a change to druid.sql.dialect.presto.ast.stmt can't break druid.
Position
Below the diagonal: druid.sql.dialect.presto.ast.stmt uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.ast.stmt uses druid.sql.dialect.hive.ast, so a change to druid.sql.dialect.hive.ast can break druid.sql.dialect.presto.ast.stmt, while a change to druid.sql.dialect.presto.ast.stmt can't break druid.sql.dialect.hive.ast.
Position
Below the diagonal: druid.sql.dialect.presto.ast.stmt uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.ast.stmt uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.sql.dialect.presto.ast.stmt, while a change to druid.sql.dialect.presto.ast.stmt can't break druid.sql.visitor.
Position
Below the diagonal: druid.sql.dialect.presto.ast.stmt uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.ast.stmt uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.sql.dialect.presto.ast.stmt, while a change to druid.sql.dialect.presto.ast.stmt can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.sql.dialect.presto.ast.stmt uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.ast.stmt uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.sql.dialect.presto.ast.stmt, while a change to druid.sql.dialect.presto.ast.stmt can't break druid.sql.ast.expr.
Position
Below the diagonal: druid.sql.dialect.presto.ast.stmt uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.ast.stmt uses druid.sql.ast, so a change to druid.sql.ast can break druid.sql.dialect.presto.ast.stmt, while a change to druid.sql.dialect.presto.ast.stmt can't break druid.sql.ast.
Position
Below the diagonal: druid.sql.dialect.presto.ast.stmt uses a module listed above it, which is the healthy direction.
druid.sql.dialect.presto.ast.stmt uses druid.sql.dialect.presto.visitor, so a change to druid.sql.dialect.presto.visitor can break druid.sql.dialect.presto.ast.stmt, while a change to druid.sql.dialect.presto.ast.stmt can't break druid.sql.dialect.presto.visitor.
Position
Below the diagonal: druid.sql.dialect.presto.ast.stmt uses a module listed above it, which is the healthy direction.
druid.stat uses druid.support.logging, so a change to druid.support.logging can break druid.stat, while a change to druid.stat can't break druid.support.logging.
Position
Below the diagonal: druid.stat uses a module listed above it, which is the healthy direction.
druid.proxy.jdbc uses druid.filter, so a change to druid.filter can break druid.proxy.jdbc, while a change to druid.proxy.jdbc can't break druid.filter.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
druid.wall uses druid.support.logging, so a change to druid.support.logging can break druid.wall, while a change to druid.wall can't break druid.support.logging.
Position
Below the diagonal: druid.wall uses a module listed above it, which is the healthy direction.
druid.wall uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.wall, while a change to druid.wall can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.wall uses a module listed above it, which is the healthy direction.
druid.wall uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.wall, while a change to druid.wall can't break druid.sql.ast.expr.
Position
Below the diagonal: druid.wall uses a module listed above it, which is the healthy direction.
druid.pool uses druid.support.logging, so a change to druid.support.logging can break druid.pool, while a change to druid.pool can't break druid.support.logging.
Position
Below the diagonal: druid.pool uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.support.logging, so a change to druid.support.logging can break druid.wall.spi, while a change to druid.wall.spi can't break druid.support.logging.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.db2.visitor, so a change to druid.sql.dialect.db2.visitor can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.db2.visitor.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.mysql.ast.statement, so a change to druid.sql.dialect.mysql.ast.statement can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.mysql.ast.statement.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.sqlserver.visitor, so a change to druid.sql.dialect.sqlserver.visitor can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.sqlserver.visitor.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.sqlserver.ast, so a change to druid.sql.dialect.sqlserver.ast can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.sqlserver.ast.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.oracle.visitor, so a change to druid.sql.dialect.oracle.visitor can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.oracle.visitor.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.oracle.ast.stmt, so a change to druid.sql.dialect.oracle.ast.stmt can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.oracle.ast.stmt.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.postgresql.visitor, so a change to druid.sql.dialect.postgresql.visitor can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.postgresql.visitor.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.postgresql.ast.stmt, so a change to druid.sql.dialect.postgresql.ast.stmt can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.postgresql.ast.stmt.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.parser, so a change to druid.sql.parser can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.parser.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.visitor, so a change to druid.sql.visitor can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.visitor.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.mysql.ast.expr, so a change to druid.sql.dialect.mysql.ast.expr can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.mysql.ast.expr.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.dialect.mysql.visitor, so a change to druid.sql.dialect.mysql.visitor can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.dialect.mysql.visitor.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.ast.statement, so a change to druid.sql.ast.statement can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.ast.statement.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
druid.wall.spi uses druid.sql.ast.expr, so a change to druid.sql.ast.expr can break druid.wall.spi, while a change to druid.wall.spi can't break druid.sql.ast.expr.
Position
Below the diagonal: druid.wall.spi uses a module listed above it, which is the healthy direction.
42 pairs of types, where a type in druid.wall.spi uses a type in druid.wall. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.filter uses druid.support.logging, so a change to druid.support.logging can break druid.filter, while a change to druid.filter can't break druid.support.logging.
Position
Below the diagonal: druid.filter uses a module listed above it, which is the healthy direction.
38 pairs of types, where a type in druid.filter uses a type in druid.proxy.jdbc. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
druid.filter uses druid.proxy.jdbc, so a change to druid.proxy.jdbc can break druid.filter, while a change to druid.filter can't break druid.proxy.jdbc.
Position
Below the diagonal: druid.filter uses a module listed above it, which is the healthy direction.
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 category
Findings
Severity
A03:2025 — Software Supply Chain Failures
86
High / Critical
A05:2025 — Injection
19
High / Critical
A02:2025 — Security Misconfiguration
3
Medium
A07:2025 — Authentication Failures
2
High / Critical
Roadmap
Top priorities: Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2); Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href; Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2).
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Resolve the 4 No assertions (empty test) finding(s) in Test Quality — start with ReuseStatFilterTest.java, DruidDataSourceTest_closeError.java, MySQLParameterizedTest.java.
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
God Classes: TooManyMethods: SQLCreateDatabaseStatement
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 — 132
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 — 4260
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 — 311
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 15
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 71 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, 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 — 71 dimensions across the health lenses
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
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, 4578 of 4703 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.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
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.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
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 READ here — but this repository measures it: a coverage step in CI (`codecov/codecov-action`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.java), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored.
D12 Dependency Hygiene — 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. Currency was graded against Maven Central, but whether an artifact is DEPRECATED is not: Maven Central publishes no deprecation marker, exactly as rubygems.org does not. Whether one is UNMAINTAINED is not graded either — no registry publishes a maintenance status, and release age does not stand in for one. Two of this dimension's four signals are therefore unread on a Gradle tree, and its score reflects currency alone.
D19 Documentation Quality — 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. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming 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. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its 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's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
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.
AC3 Page structure — 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. 85 further occurrence(s) are not listed individually; the score already reflects all 125.
AC4 Keyboard semantics — 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. 205 further occurrence(s) are not listed individually; the score already reflects all 245.
AXR1 Runtime accessibility — 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. User interface: 52 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. Boot: crawled PUBLIC routes only — add a Playwright storageState (e.g. playwright/.auth/user.json) or a test auth-setup to crawl authenticated screens rendered 0/1 surface(s) × 2 renders render failed for http://127.0.0.1:3306: page.goto: net::ERR_CONNECTION_RESET at http://127.0.0.1:3306/
Call log:
- navigating to "http://127.0.0.1:3306/", waiting until "load"
rendered 0/1 surface(s) × 2 renders render failed for http://127.0.0.1:5432: page.goto: net::ERR_EMPTY_RESPONSE at http://127.0.0.1:5432/
Call log:
- navigating to "http://127.0.0.1:5432/", waiting until "load"
.
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.
GD1 Unfinished & placeholder code — 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 C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Java is most of its product and is not read 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.
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.
P8 Schema migrations — 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. The schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
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.
X10 Duplicated predicate — 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. 152 further occurrence(s) are not listed individually; the score already reflects all 192.
X12 Unreachable branch — 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
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.
D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
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.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
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").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
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.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
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.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
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.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
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.
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.
511 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was MySqlStatementParser.parseShow at 275. A further 13 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 JdbcUtils.getTypeName at 36 — they are counted neither in the figure above nor in this dimension's score. 4 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: core/src/main/java/com/alibaba/druid/sql/repository/function/SignatureUtils.java (SignatureUtils.getJavaType at 26), core/src/main/java/com/alibaba/druid/pool/vendor/InformixExceptionSorter.java (InformixExceptionSorter.isExceptionFatal at 19), core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOperator.java (SQLBinaryOperator.isRelational at 19), core/src/main/java/com/alibaba/druid/proxy/jdbc/JdbcParameterNull.java (JdbcParameterNull.valueOf at 18). 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.
+ 460 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 240 down to 240 or less in Cyclomatic Complexity — start with MySqlStatementParser.parseShow (cyclomatic 275). — Refactoring it lifts Cyclomatic Complexity from 5.0 to about 5.1/10.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
+ 746 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 6 bodies over 240 down to 240 or less in Cognitive Complexity — start with MySqlStatementParser.parseShow (cognitive 475), SQLSelectParser.parseTableSourceRest (cognitive 340), MySqlCreateTableParser.parseCreateTable (cognitive 317). — 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 6 together lifts Cognitive Complexity from 3.1 to about 4.0/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.0 / 10Adequate✓ 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.
Resolve the 130 TooManyMethods finding(s) in God Classes — start with SQLASTOutputVisitor.java, FilterChainImpl.java, FilterAdapter.java. — One of this dimension's main actionable groups (130 warning-level).
Resolve the 98 MethodTooLong finding(s) in God Classes — start with SQLStatementParser.java (11), OracleStatementParser.java (6), MySqlExprParser.java (5). — One of this dimension's main actionable groups (98 warning-level).
Resolve the 73 ClassTooLong finding(s) in God Classes — start with SQLASTOutputVisitor.java, SQLStatementParser.java, MySqlOutputVisitor.java. — One of this dimension's main actionable groups (73 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
1183 duplicated block group(s) detected. A further 464 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 1 of the 1647 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 426 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 55 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with MySqlOutputVisitor.java (5), OracleStatementParser.java (3), SQLASTOutputVisitor.java (3). — One of this dimension's main actionable groups (55 warning-level).
Resolve the 52 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with MockCallableStatement.java (6), MySqlStatementParser.java (3), SQLOrderBy.java (2). — One of this dimension's main actionable groups (52 warning-level).
Resolve the 46 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with MySqlOutputVisitor.java (4), SQLSubqueryTableSource.java (2), DorisOutputVisitor.java (2). — One of this dimension's main actionable groups (46 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling8.7 / 10Strong✓ 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.
6 production modules (Maven), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 1 module(s) off the main sequence.
Off the main sequence: druid
What to do
Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 14 Low cohesion finding(s) in Cohesion (LCOM4) — start with DruidDataSource.java, PreparedStatementProxyImpl.java, ResultSetProxyImpl.java. — One of this dimension's main actionable groups (14 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality9.0 / 10Adequategated by 16 critical findings✓ 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.
1 skipped (1 with a documented reason), 290 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 4776 tests.
Resolve the 12 Assertions commented out finding(s) in Test Quality — start with Issue4316.java, LexerParameterizedTest.java, TPCDS_ALL_Resolve.java. — One of this dimension's main actionable groups (12 issue-level).
Resolve the 4 No assertions (empty test) finding(s) in Test Quality — start with ReuseStatFilterTest.java, DruidDataSourceTest_closeError.java, MySQLParameterizedTest.java. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 274 No assertions finding(s) in Test Quality — start with WallPerformanceTest_1.java (14), H2OutputVisitorTest.java (10), SQLSelectTest.java (8). — One of this dimension's main actionable groups (274 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests pass reliably, with no flakiness.
Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
This repository's Gradle dependency graph was RESOLVED BY A BUILD, across every subproject rather than the root alone: 113 artifact(s) resolved, 113 of them gradable against Maven Central, and 107 behind a shipped release. Where a version was requested and a different one won conflict resolution, the RESOLVED version is what is graded — grading the request would recommend an upgrade already applied. Known CVEs in the same graph are a separate question again, reported under D30.
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.
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.
1 of 69 declared JVM dependency artifact(s) use a banned license. Licences were resolved from the POMs Maven Central publishes, over the coordinates this repository's 9 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. 50 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. 3 of them resolve to no licence at all on Central, even through their parent POMs; that is missing data, not a violation, and none of them is charged. A further 1 coordinate(s) are not published to Maven Central — another repository (Google's Maven hosts androidx), a SNAPSHOT, or a private artifact — so their licences are not readable from here and they are outside this verdict. 1 name a copyleft licence without stating its version (e.g. "GNU Lesser General Public Licence"), which this policy bans only at specific versions; they are reported here and not charged, because guessing the version would either accuse an LGPL-2.1 artifact or clear an LGPL-3.0 one.
Banned license: com.mysql:mysql-connector-j
What to do
Resolve the 1 Banned license finding(s) in License Compliance. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d14_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 1 Hotspot finding(s) in Churn × Complexity Hotspots — start with PGSelectParser.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.
Do you agree with this assessment?
D16 · Bus Factor9.8 / 10Exemplary✓ 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.
8 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java. Counted over 500 of the 1758 production source files in this repository: 1038 are under the ~2,400-byte size floor this dimension measures over, and the remaining 220 have no attributable history left to measure.
Off-boarding risk: anonymized user #1
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
420 deducted task-comment markers across 272789 LoC (0.2/KLoC) → score 9.7. 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.
Resolve the 414 TodoComment finding(s) in Explicit Debt — start with OracleMockPreparedStatement.java (154), OracleMockConnection.java (142), OracleMockResultSet.java (86). — One of this dimension's main actionable groups (414 warning-level).
Resolve the 4 FixmeComment finding(s) in Explicit Debt — start with AntlrMySqlTest.java (2), MySqlWallTest72.java, MySqlWallTest90.java. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 1 HackComment finding(s) in Explicit Debt — start with MySqlStatementParser.java. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
1 of 1 documentation facets pass in full. 23 document(s) read across 1 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with build.gradle. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
1 of 6 build units (Maven) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D27 · Navigability8.1 / 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.
63 % of calls cross a namespace and 38 % go through an interface, but 100 % of collaborators are co-located — so following a call takes several hops. Baseline: small — navigation cost is tolerated.
High interface indirection
What to do
Resolve the 1 High interface indirection finding(s) in Navigability. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d27_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
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).
19 finding(s): 0 critical, 8 high, 11 medium, 0 low. 3 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 3 file(s) — `druid-demo-petclinic/gradlew` (line 72, line 173), `druid-demo-petclinic/mvnw` (lines 220–221), `mvnw` (lines 220–221) — 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.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
No action in Static Analysis (SAST) — all 3 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 (3 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 39 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (39). — One of this dimension's main actionable groups (39 issue-level).
Resolve the 20 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (20). — One of this dimension's main actionable groups (20 issue-level).
Resolve the 19 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (19). — One of this dimension's main actionable groups (19 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 2 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
94 of 720 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java. Counted over 720 of the 1758 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 4 Orphaned knowledge finding(s) in Knowledge Freshness — start with OscarOutputVisitor.java, OscarStatementParser.java, MonitorStatService.java. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 90 Orphaned file finding(s) in Knowledge Freshness — start with DruidStatProperties.java (2), DruidFilterConfiguration.java (2), DruidDataSourceAutoConfigure.java (2). — One of this dimension's main actionable groups (90 recommendation-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 10 Change coupling finding(s) in Change Coupling — start with BigQueryStatementParser.java (2), PGSQLStatementParser.java (2), SQLServerSelectParser.java. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 3 Change-coupling hub finding(s) in Change Coupling — start with SQLServerStatementParser.java, OdpsOutputVisitor.java, SQLASTOutputVisitor.java. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
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).
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.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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.
0 end-of-life runtime(s) and 1 end-of-life framework(s), read from 4 platform declaration(s) and 87 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.
End-of-life framework: Spring Boot 2REDACTED:1
What to do
Resolve the 1 End-of-life framework finding(s) in Platform End-of-Life — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d44_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives2.2 / 10Critical✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative. (×3) — core/src/main/resources/support/http/resources/js/common.js:32, druid-demo-petclinic/src/main/resources/templates/error.html:6, druid-demo-petclinic/src/main/resources/templates/welcome.html:10
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels5.2 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one. (×2) — core/src/main/resources/support/http/resources/login.html:55, druid-admin/src/main/resources/support/http/resources/login.html:53
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×4) — core/src/main/resources/support/http/resources/login.html:61, core/src/main/resources/support/http/resources/login.html:64, druid-admin/src/main/resources/support/http/resources/login.html:58, …
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×16) — core/src/main/resources/support/http/resources/sql-detail.html:23, druid-admin/src/main/resources/support/http/resources/sql-detail.html:23, druid-demo-petclinic/src/main/resources/templates/fragments/inputField.html:11, …
This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×4) — druid-demo-petclinic/src/main/resources/templates/fragments/inputField.html:8, druid-demo-petclinic/src/main/resources/templates/fragments/selectField.html:8, druid-demo-petclinic/src/main/resources/templates/owners/findOwners.html:12, …
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Do you agree with this assessment?
AC3 · Page structure4.7 / 10Weak✓ Tool-verified
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). (×14) — core/src/main/resources/support/http/resources/activeConnectionStackTrace.html:2, core/src/main/resources/support/http/resources/api.html:2, REDACTED:2, …
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×15) — core/src/main/resources/support/http/resources/activeConnectionStackTrace.html:2, core/src/main/resources/support/http/resources/api.html:2, REDACTED:2, …
A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). (×8) — core/src/main/resources/support/http/resources/index.html:19, core/src/main/resources/support/http/resources/spring-detail.html:21, core/src/main/resources/support/http/resources/sql-detail.html:29, …
An empty <title> gives no page name in the tab, history or screen-reader page list. Put descriptive text in the <title>. — core/src/main/resources/support/http/resources/nopermit.html:2
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — core/src/main/resources/support/http/resources/sql-detail.html:21
An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative. — core/src/main/resources/support/http/resources/sql-detail.html:21
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action. (×40) — core/src/main/resources/support/http/resources/header.html:2, core/src/main/resources/support/http/resources/spring-detail.html:19, core/src/main/resources/support/http/resources/spring.html:48, …
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`.navbar li:hover > a` sets color: #eeeeee on background-color: #6db33f — 2.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. (×2) — druid-demo-petclinic/src/main/scss/header.scss:57, druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:7973
`.btn-check:focus + .btn` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:2137
`.modal` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4105
`.modal-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4146
`.carousel-control-prev:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4599
`.offcanvas` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4742
`.myspinner` moves (`animation-name: spinner`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. (×2) — druid-demo-petclinic/src/main/scss/petclinic.scss:192, druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:7869
`.spinner-border` moves (`animation: 0.75s linear infinite spinner-border`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4699
`.spinner-grow` moves (`animation: 0.75s linear infinite spinner-grow`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4721
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Architecture — Whether any singleton service captures a scoped/transient dependency — a silent lifetime/threading bug.
Method: Roslyn scan: DI registrations parsed from AddSingleton/Scoped/Transient; each singleton checked for captured shorter-lifetime dependencies. Exhaustive, deterministic.
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.
Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
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.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
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.
`LogFilterMBean` declares 58 abstract methods: `getConnectionLoggerName`, `getDataSourceLoggerName`, `getResultSetLoggerName`, `getStatementLoggerName`, `getStatementSqlFormatOption`, `isConnectionCloseAfterLogEnabled`, `isConnectionCommitAfterLogEnabled`, `isConnectionConnectAfterLogEnabled`, `isConnectionConnectBeforeLogEnabled`, `isConnectionLogEnabled`, `isConnectionLogErrorEnabled`, `isDataSourceLogEnabled`, `isResultSetCloseAfterLogEnabled`, `isResultSetLogEnabled`, `isResultSetLogErrorEnabled`, `isResultSetNextAfterLogEnabled`, `isResultSetOpenAfterLogEnabled`, `isStatementCloseAfterLogEnabled`, `isStatementCreateAfterLogEnabled`, `isStatementExecuteAfterLogEnabled`, `isStatementExecuteBatchAfterLogEnabled`, `isStatementExecuteQueryAfterLogEnabled`, `isStatementExecuteUpdateAfterLogEnabled`, `isStatementLogEnabled`, `isStatementLogErrorEnabled`, `isStatementParameterSetLogEnabled`, `isStatementPrepareAfterLogEnabled`, `isStatementPrepareCallAfterLogEnabled`, `isStatementSqlPrettyFormat`, `setConnectionCloseAfterLogEnabled`, `setConnectionCommitAfterLogEnabled`, `setConnectionConnectAfterLogEnabled`, `setConnectionConnectBeforeLogEnabled`, `setConnectionLogEnabled`, `setConnectionLogErrorEnabled`, `setConnectionLoggerName`, `setDataSourceLogEnabled`, `setDataSourceLoggerName`, `setResultSetCloseAfterLogEnabled`, `setResultSetLogEnabled`, and 18 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. 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. — core/src/main/java/com/alibaba/druid/filter/logging/LogFilterMBean.java:23
`Filter` declares 491 abstract methods: `callableStatement_getArray`, `callableStatement_getArray`, `callableStatement_getBigDecimal`, `callableStatement_getBigDecimal`, `callableStatement_getBigDecimal`, `callableStatement_getBlob`, `callableStatement_getBlob`, `callableStatement_getBoolean`, `callableStatement_getBoolean`, `callableStatement_getByte`, `callableStatement_getByte`, `callableStatement_getBytes`, `callableStatement_getBytes`, `callableStatement_getCharacterStream`, `callableStatement_getCharacterStream`, `callableStatement_getClob`, `callableStatement_getClob`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDouble`, `callableStatement_getDouble`, `callableStatement_getFloat`, `callableStatement_getFloat`, `callableStatement_getInt`, `callableStatement_getInt`, `callableStatement_getLong`, `callableStatement_getLong`, `callableStatement_getNCharacterStream`, `callableStatement_getNCharacterStream`, `callableStatement_getNClob`, `callableStatement_getNClob`, `callableStatement_getNString`, `callableStatement_getNString`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getRef`, and 451 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 491 declarations carry 294 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 294 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. — core/src/main/java/com/alibaba/druid/filter/Filter.java:35
`FilterChain` declares 490 abstract methods: `callableStatement_getArray`, `callableStatement_getArray`, `callableStatement_getBigDecimal`, `callableStatement_getBigDecimal`, `callableStatement_getBigDecimal`, `callableStatement_getBlob`, `callableStatement_getBlob`, `callableStatement_getBoolean`, `callableStatement_getBoolean`, `callableStatement_getByte`, `callableStatement_getByte`, `callableStatement_getBytes`, `callableStatement_getBytes`, `callableStatement_getCharacterStream`, `callableStatement_getCharacterStream`, `callableStatement_getClob`, `callableStatement_getClob`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDouble`, `callableStatement_getDouble`, `callableStatement_getFloat`, `callableStatement_getFloat`, `callableStatement_getInt`, `callableStatement_getInt`, `callableStatement_getLong`, `callableStatement_getLong`, `callableStatement_getNCharacterStream`, `callableStatement_getNCharacterStream`, `callableStatement_getNClob`, `callableStatement_getNClob`, `callableStatement_getNString`, `callableStatement_getNString`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getRef`, and 450 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 490 declarations carry 295 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 295 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. — core/src/main/java/com/alibaba/druid/filter/FilterChain.java:35
`DruidAbstractDataSourceMBean` declares 77 abstract methods: `getActiveConnectionStackTrace`, `getActiveCount`, `getCachedPreparedStatementAccessCount`, `getCachedPreparedStatementCount`, `getCachedPreparedStatementDeleteCount`, `getCachedPreparedStatementHitCount`, `getCachedPreparedStatementMissCount`, `getCloseCount`, `getClosedPreparedStatementCount`, `getCommitCount`, `getConnectCount`, `getConnectErrorCount`, `getConnectionErrorRetryAttempts`, `getCreateCount`, `getCreateErrorCount`, `getCreateTimespanMillis`, `getCreatedTime`, `getDbType`, `getDefaultCatalog`, `getDefaultReadOnly`, `getDefaultTransactionIsolation`, `getDestroyCount`, `getDriverClassName`, `getDriverMajorVersion`, `getDriverMinorVersion`, `getDupCloseCount`, `getExceptionSorterClassName`, `getFilterClassNames`, `getInitialSize`, `getLoginTimeout`, `getMaxActive`, `getMaxIdle`, `getMaxOpenPreparedStatements`, `getMaxPoolPreparedStatementPerConnectionSize`, `getMaxWait`, `getMaxWaitThreadCount`, `getMinEvictableIdleTimeMillis`, `getMinIdle`, `getName`, `getPoolingCount`, and 37 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. 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. — core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSourceMBean.java:21
`DruidDataSourceC3P0AdapterMBean` declares 24 abstract methods: `close`, `getCheckoutTimeout`, `getDataSourceName`, `getDriverClass`, `getIdleConnectionTestPeriod`, `getInitialPoolSize`, `getJdbcUrl`, `getLockQueueLength`, `getMaxIdleTime`, `getMaxPoolSize`, `getMinPoolSize`, `getNumBusyConnections`, `getNumConnections`, `getNumIdleConnections`, `getPreferredTestQuery`, `getProperties`, `getUser`, `getWaitThreadCount`, `isAutoCommitOnClose`, `isEnable`, `isTestConnectionOnCheckin`, `isTestConnectionOnCheckout`, `shrink`, `toString`. 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. — core/src/main/java/com/alibaba/druid/pool/DruidDataSourceC3P0AdapterMBean.java:20
`DruidDataSourceMBean` declares 33 abstract methods: `clearStatementCache`, `dump`, `fill`, `fill`, `getActivePeak`, `getActivePeakTime`, `getDiscardCount`, `getErrorCount`, `getLockQueueLength`, `getNotEmptySignalCount`, `getNotEmptyWaitCount`, `getNotEmptyWaitMillis`, `getNotEmptyWaitNanos`, `getNotEmptyWaitThreadCount`, `getObjectName`, `getPoolingPeak`, `getPoolingPeakTime`, `getResetCount`, `getTimeBetweenLogStatsMillis`, `getUrl`, `getVersion`, `getWaitThreadCount`, `isEnable`, `isResetStatEnable`, `isUseGlobalDataSourceStat`, `removeAbandoned`, `resetStat`, `setConnectionProperties`, `setPoolPreparedStatements`, `setResetStatEnable`, `setStatLoggerClassName`, `setTimeBetweenLogStatsMillis`, `shrink`. 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 33 declarations carry 32 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 32 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. — core/src/main/java/com/alibaba/druid/pool/DruidDataSourceMBean.java:26
`ResultSetProxy` declares 25 abstract methods: `addReadBytesLength`, `addReadStringLength`, `getCloseCount`, `getConstructNano`, `getCursorIndex`, `getFetchRowCount`, `getHiddenColumnCount`, `getHiddenColumns`, `getLogicColumn`, `getOpenInputStreamCount`, `getOpenReaderCount`, `getPhysicalColumn`, `getReadBytesLength`, `getReadStringLength`, `getResultSetRaw`, `getSql`, `getSqlStat`, `getStatementProxy`, `incrementOpenInputStreamCount`, `incrementOpenReaderCount`, `setConstructNano`, `setConstructNano`, `setHiddenColumns`, `setLogicColumnMap`, `setPhysicalColumnMap`. 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 25 declarations carry 24 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 24 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. — core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxy.java:27
`StatementProxy` declares 18 abstract methods: `getBatchSql`, `getBatchSqlList`, `getConnectionProxy`, `getLastExecuteSql`, `getLastExecuteStartNano`, `getLastExecuteTimeNano`, `getLastExecuteType`, `getParameter`, `getParameters`, `getParametersSize`, `getRawObject`, `getSqlStat`, `isFirstResultSet`, `setLastExecuteStartNano`, `setLastExecuteStartNano`, `setLastExecuteTimeNano`, `setLastExecuteTimeNano`, `setSqlStat`. 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 18 declarations carry 16 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 16 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. — core/src/main/java/com/alibaba/druid/proxy/jdbc/StatementProxy.java:27
`SQLTableSource` declares 22 abstract methods: `aliasHashCode64`, `clone`, `computeAlias`, `containsAlias`, `findColumn`, `findColumn`, `findTableSource`, `findTableSource`, `findTableSourceWithColumn`, `findTableSourceWithColumn`, `findTableSourceWithColumn`, `findTableSourceWithColumn`, `getAlias`, `getFlashback`, `getHints`, `getPivot`, `getUnpivot`, `resolveColumn`, `setAlias`, `setFlashback`, `setPivot`, `setUnpivot`. 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 22 declarations carry 17 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 17 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. — core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSource.java:22
`SQLDataType` declares 16 abstract methods: `clone`, `getArguments`, `getDbType`, `getName`, `getWithTimeZone`, `hasKeyLength`, `isInt`, `isNumberic`, `isString`, `isWithLocalTimeZone`, `jdbcType`, `nameHashCode64`, `setDbType`, `setName`, `setWithLocalTimeZone`, `setWithTimeZone`. 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. — core/src/main/java/com/alibaba/druid/sql/ast/SQLDataType.java:22
`SQLObject` declares 19 abstract methods: `accept`, `addAfterComment`, `addAfterComment`, `addBeforeComment`, `addBeforeComment`, `clone`, `containsAttribute`, `getAfterCommentsDirect`, `getAttribute`, `getAttributes`, `getAttributesDirect`, `getBeforeCommentsDirect`, `getParent`, `getParent`, `hasAfterComment`, `hasBeforeComment`, `output`, `putAttribute`, `setParent`. 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 19 declarations carry 16 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 16 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. — core/src/main/java/com/alibaba/druid/sql/ast/SQLObject.java:23
`OracleSegmentAttributes` declares 22 abstract methods: `getCompress`, `getCompressLevel`, `getInitrans`, `getLogging`, `getMaxtrans`, `getPctfree`, `getPctincrease`, `getPctused`, `getStorage`, `getTablespace`, `isCompressForOltp`, `setCompress`, `setCompressForOltp`, `setCompressLevel`, `setInitrans`, `setLogging`, `setMaxtrans`, `setPctfree`, `setPctincrease`, `setPctused`, `setStorage`, `setTablespace`. 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. — core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OracleSegmentAttributes.java:24
`JdbcSqlStatMBean` declares 19 abstract methods: `getConcurrentMax`, `getErrorCount`, `getExecuteBatchSizeMax`, `getExecuteBatchSizeTotal`, `getExecuteCount`, `getExecuteErrorLastTime`, `getExecuteLastStartTime`, `getExecuteMillisMax`, `getExecuteMillisTotal`, `getExecuteNanoSpanMaxOccurTime`, `getExecuteSuccessCount`, `getFetchRowCount`, `getFile`, `getId`, `getName`, `getRunningCount`, `getSql`, `getUpdateCount`, `reset`. 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. — core/src/main/java/com/alibaba/druid/stat/JdbcSqlStatMBean.java:23
`Log` declares 16 abstract methods under just 13 distinct name(s): `debug`, `debug`, `error`, `error`, `getDebugCount`, `getErrorCount`, `getInfoCount`, `getWarnCount`, `info`, `isDebugEnabled`, `isErrorEnabled`, `isInfoEnabled`, `isWarnEnabled`, `resetStat`, `warn`, `warn`. 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 16 separate responsibilities: a caller binds to 13 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 16 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. — core/src/main/java/com/alibaba/druid/support/logging/Log.java:18
`WallConfigMBean` declares 56 abstract methods: `getDenyFunctions`, `getDenyObjects`, `getDenySchemas`, `getDenyTables`, `getDenyVariants`, `getDir`, `getReadOnlyTables`, `init`, `isCommentAllow`, `isDeleteAllow`, `isDeleteWhereAlwayTrueCheck`, `isDenyFunction`, `isDenyObjects`, `isDenySchema`, `isFunctionCheck`, `isInited`, `isInsertAllow`, `isMergeAllow`, `isMultiStatementAllow`, `isNoneBaseStatementAllow`, `isObjectCheck`, `isSchemaCheck`, `isSelectHavingAlwayTrueCheck`, `isSelectIntoAllow`, `isSelectIntoOutfileAllow`, `isSelectUnionCheck`, `isSelectWhereAlwayTrueCheck`, `isSelelctAllow`, `isTableCheck`, `isTruncateAllow`, `isUpdateAllow`, `isUpdateWhereAlayTrueCheck`, `isVariantCheck`, `loadConfig`, `setCommentAllow`, `setDeleteAllow`, `setDeleteWhereAlwayTrueCheck`, `setDir`, `setFunctionCheck`, `setInsertAllow`, and 16 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. 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. — core/src/main/java/com/alibaba/druid/wall/WallConfigMBean.java:20
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.
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.
`getPriority` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOperator.java:109
`MySqlProcedureExecutor` has 12 unfinished members out of 12 declared methods (whether or not each carries a body) — a scaffolded class that was never implemented. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:25
`executeStatements` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:26
`executeStatement` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:30
`executeIf` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:34
`executeWhile` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:38
`executeLoop` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:42
`executeCase` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:46
`executeAssign` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:50
`executeOpen` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:54
`executeFetch` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:58
`executeClose` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:62
`executeSQL` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:66
`executeFunction` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:70
`parseCreateScan` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4256
`parseClone` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7980
`collect` has an empty body — confirm it's an intentional no-op and not an unfinished method. — core/src/main/java/com/alibaba/druid/support/metrics/MetricCollector.java:19
`stop` has an empty body — confirm it's an intentional no-op and not an unfinished method. — core/src/main/java/com/alibaba/druid/support/monitor/MonitorClient.java:170
A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something. (×2) — core/src/test/java/com/alibaba/druid/bvt/sql/bigquery/BigQueryDirTest.java:19, core/src/test/java/com/alibaba/druid/oceanbase/OceanBaseOracleXATest.java:21
What to do
Finish or delete the unfinished stubs (functions that throw "not implemented", or whose body is empty or a bare constant) — they are dead surface that looks live.
Clear the softer debt: re-enable or delete @Disabled/@Ignore tests, decide whether each empty method or UnsupportedOperationException is deliberate (and say so in a comment), and replace @SuppressWarnings("all") with targeted, justified suppressions.
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.
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.
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.
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.
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.
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.
Do you agree with this assessment?
P10 · Library API & versioning9.8 / 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.alibaba.druid.filter` is marked as implementation by its own namespace, folder or name: `FilterChainImpl` (core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:36, 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. — core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:36
1 public type in `com.alibaba.druid.mock.handler` is marked as implementation by its own namespace, folder or name: `MySqlMockExecuteHandlerImpl` (core/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java:37, 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. — core/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java:37
1 public type in `com.alibaba.druid.pool` is marked as implementation by its own namespace, folder or name: `DruidDataSourceStatLoggerImpl` (core/src/main/java/com/alibaba/druid/pool/DruidDataSourceStatLoggerImpl.java:34, 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. — core/src/main/java/com/alibaba/druid/pool/DruidDataSourceStatLoggerImpl.java:34
12 public types in `com.alibaba.druid.proxy.jdbc` are marked as implementation by their own namespace, folder or name: `CallableStatementProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:30, name ends in `Impl`), `ClobProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/ClobProxyImpl.java:31, name ends in `Impl`), `ConnectionProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/ConnectionProxyImpl.java:30, name ends in `Impl`), `DataSourceProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/DataSourceProxyImpl.java:39, name ends in `Impl`), `DatabaseMetaDataProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/DatabaseMetaDataProxyImpl.java:23, name ends in `Impl`), `JdbcParameterImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/JdbcParameterImpl.java:20, name ends in `Impl`), `NClobProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/NClobProxyImpl.java:20, name ends in `Impl`), `PreparedStatementProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:34, name ends in `Impl`), and 4 more. While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:30
4 public types in `com.alibaba.druid.sql.ast` are marked as implementation by their own namespace, folder or name: `SQLDataTypeImpl` (core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:29, name ends in `Impl`), `SQLExprImpl` (core/src/main/java/com/alibaba/druid/sql/ast/SQLExprImpl.java:20, name ends in `Impl`), `SQLObjectImpl` (core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:31, name ends in `Impl`), `SQLStatementImpl` (core/src/main/java/com/alibaba/druid/sql/ast/SQLStatementImpl.java:26, 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. — core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:29
4 public types in `com.alibaba.druid.sql.ast.statement` are marked as implementation by their own namespace, folder or name: `SQLConstraintImpl` (core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLConstraintImpl.java:25, name ends in `Impl`), `SQLForeignKeyImpl` (core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLForeignKeyImpl.java:24, name ends in `Impl`), `SQLPrimaryKeyImpl` (core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLPrimaryKeyImpl.java:20, name ends in `Impl`), `SQLTableSourceImpl` (core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSourceImpl.java:28, 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. — core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLConstraintImpl.java:25
4 public types in `com.alibaba.druid.sql.builder.impl` are marked as implementation by their own namespace, folder or name: `SQLBuilderImpl` (core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLBuilderImpl.java:23, `impl`), `SQLDeleteBuilderImpl` (core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLDeleteBuilderImpl.java:33, `impl`), `SQLSelectBuilderImpl` (core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:31, `impl`), `SQLUpdateBuilderImpl` (core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLUpdateBuilderImpl.java:36, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLBuilderImpl.java:23
1 public type in `com.alibaba.druid.sql.dialect.db2.ast` is marked as implementation by its own namespace, folder or name: `DB2StatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/DB2StatementImpl.java:23, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/DB2StatementImpl.java:23
1 public type in `com.alibaba.druid.sql.dialect.dm.ast` is marked as implementation by its own namespace, folder or name: `DmObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/dm/ast/DmObjectImpl.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. — core/src/main/java/com/alibaba/druid/sql/dialect/dm/ast/DmObjectImpl.java:7
1 public type in `com.alibaba.druid.sql.dialect.doris.ast` is marked as implementation by its own namespace, folder or name: `DorisObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/doris/ast/DorisObjectImpl.java:6, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/doris/ast/DorisObjectImpl.java:6
1 public type in `com.alibaba.druid.sql.dialect.gaussdb.ast` is marked as implementation by its own namespace, folder or name: `GaussDbObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/ast/GaussDbObjectImpl.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. — core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/ast/GaussDbObjectImpl.java:7
2 public types in `com.alibaba.druid.sql.dialect.mysql.ast` are marked as implementation by their own namespace, folder or name: `MySqlIndexHintImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlIndexHintImpl.java:25, name ends in `Impl`), `MySqlObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlObjectImpl.java:22, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlIndexHintImpl.java:25
1 public type in `com.alibaba.druid.sql.dialect.mysql.ast.expr` is marked as implementation by its own namespace, folder or name: `MySqlExprImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/expr/MySqlExprImpl.java:22, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/expr/MySqlExprImpl.java:22
1 public type in `com.alibaba.druid.sql.dialect.mysql.ast.statement` is marked as implementation by its own namespace, folder or name: `MySqlStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlStatementImpl.java:26, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlStatementImpl.java:26
1 public type in `com.alibaba.druid.sql.dialect.mysql.visitor` is marked as implementation by its own namespace, folder or name: `MySqlEvalVisitorImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlEvalVisitorImpl.java:28, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlEvalVisitorImpl.java:28
2 public types in `com.alibaba.druid.sql.dialect.odps.ast` are marked as implementation by their own namespace, folder or name: `OdpsObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsObjectImpl.java:23, name ends in `Impl`), `OdpsStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsStatementImpl.java:23, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsObjectImpl.java:23
2 public types in `com.alibaba.druid.sql.dialect.oracle.ast` are marked as implementation by their own namespace, folder or name: `OracleSQLObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OracleSQLObjectImpl.java:25, name ends in `Impl`), `OracleSegmentAttributesImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OracleSegmentAttributesImpl.java:25, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OracleSQLObjectImpl.java:25
1 public type in `com.alibaba.druid.sql.dialect.oracle.ast.stmt` is marked as implementation by its own namespace, folder or name: `OracleStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleStatementImpl.java:24, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleStatementImpl.java:24
1 public type in `com.alibaba.druid.sql.dialect.oscar.ast` is marked as implementation by its own namespace, folder or name: `OscarObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/OscarObjectImpl.java:22, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/OscarObjectImpl.java:22
1 public type in `com.alibaba.druid.sql.dialect.phoenix.ast` is marked as implementation by its own namespace, folder or name: `PhoenixStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/phoenix/ast/PhoenixStatementImpl.java:26, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/phoenix/ast/PhoenixStatementImpl.java:26
1 public type in `com.alibaba.druid.sql.dialect.postgresql.ast` is marked as implementation by its own namespace, folder or name: `PGSQLObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/PGSQLObjectImpl.java:22, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/PGSQLObjectImpl.java:22
1 public type in `com.alibaba.druid.sql.dialect.postgresql.ast.expr` is marked as implementation by its own namespace, folder or name: `PGExprImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGExprImpl.java:23, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGExprImpl.java:23
1 public type in `com.alibaba.druid.sql.dialect.redshift.stmt` is marked as implementation by its own namespace, folder or name: `RedshiftObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/redshift/stmt/RedshiftObjectImpl.java:6, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/redshift/stmt/RedshiftObjectImpl.java:6
2 public types in `com.alibaba.druid.sql.dialect.sqlserver.ast` are marked as implementation by their own namespace, folder or name: `SQLServerObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/SQLServerObjectImpl.java:21, name ends in `Impl`), `SQLServerStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/SQLServerStatementImpl.java:23, 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. — core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/SQLServerObjectImpl.java:21
1 public type in `com.alibaba.druid.sql.visitor` is marked as implementation by its own namespace, folder or name: `SQLEvalVisitorImpl` (core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorImpl.java:26, 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. — core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorImpl.java:26
1 public type in `com.alibaba.druid.support.http` is marked as implementation by its own namespace, folder or name: `AbstractWebStatImpl` (core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:30, 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. — core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:30
1 public type in `com.alibaba.druid.support.jakarta` is marked as implementation by its own namespace, folder or name: `AbstractWebStatImpl` (core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java:29, 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. — core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java:29
6 public types in `com.alibaba.druid.support.logging` are marked as implementation by their own namespace, folder or name: `JakartaCommonsLoggingImpl` (core/src/main/java/com/alibaba/druid/support/logging/JakartaCommonsLoggingImpl.java:21, name ends in `Impl`), `Jdk14LoggingImpl` (core/src/main/java/com/alibaba/druid/support/logging/Jdk14LoggingImpl.java:21, name ends in `Impl`), `Log4j2Impl` (core/src/main/java/com/alibaba/druid/support/logging/Log4j2Impl.java:22, name ends in `Impl`), `Log4jImpl` (core/src/main/java/com/alibaba/druid/support/logging/Log4jImpl.java:21, name ends in `Impl`), `NoLoggingImpl` (core/src/main/java/com/alibaba/druid/support/logging/NoLoggingImpl.java:18, name ends in `Impl`), `SLF4JImpl` (core/src/main/java/com/alibaba/druid/support/logging/SLF4JImpl.java:22, 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. — core/src/main/java/com/alibaba/druid/support/logging/JakartaCommonsLoggingImpl.java:21
1 public type in `com.alibaba.druid.support.monitor.dao` is marked as implementation by its own namespace, folder or name: `MonitorDaoJdbcImpl` (core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:54, 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. — core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:54
1 public type in `com.alibaba.druid.wall` is marked as implementation by its own namespace, folder or name: `WallProviderStatLoggerImpl` (core/src/main/java/com/alibaba/druid/wall/WallProviderStatLoggerImpl.java:25, 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. — core/src/main/java/com/alibaba/druid/wall/WallProviderStatLoggerImpl.java:25
What to do
Hide `com.alibaba.druid.filter` (`FilterChainImpl`) (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.alibaba.druid.mock.handler` (`MySqlMockExecuteHandlerImpl`) (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.alibaba.druid.pool` (`DruidDataSourceStatLoggerImpl`) (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.alibaba.druid.proxy.jdbc` (`CallableStatementProxyImpl`, `ClobProxyImpl`, `ConnectionProxyImpl`, `DataSourceProxyImpl`, `DatabaseMetaDataProxyImpl`, `JdbcParameterImpl`, `NClobProxyImpl`, `PreparedStatementProxyImpl`, and 4 more) (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.alibaba.druid.sql.ast` (`SQLDataTypeImpl`, `SQLExprImpl`, `SQLObjectImpl`, `SQLStatementImpl`) (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.alibaba.druid.sql.ast.statement` (`SQLConstraintImpl`, `SQLForeignKeyImpl`, `SQLPrimaryKeyImpl`, `SQLTableSourceImpl`) (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.alibaba.druid.sql.builder.impl` (`SQLBuilderImpl`, `SQLDeleteBuilderImpl`, `SQLSelectBuilderImpl`, `SQLUpdateBuilderImpl`) (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.alibaba.druid.sql.dialect.db2.ast` (`DB2StatementImpl`) (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.alibaba.druid.sql.dialect.dm.ast` (`DmObjectImpl`) (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.alibaba.druid.sql.dialect.doris.ast` (`DorisObjectImpl`) (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.alibaba.druid.sql.dialect.gaussdb.ast` (`GaussDbObjectImpl`) (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.alibaba.druid.sql.dialect.mysql.ast` (`MySqlIndexHintImpl`, `MySqlObjectImpl`) (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.alibaba.druid.sql.dialect.mysql.ast.expr` (`MySqlExprImpl`) (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.alibaba.druid.sql.dialect.mysql.ast.statement` (`MySqlStatementImpl`) (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.alibaba.druid.sql.dialect.mysql.visitor` (`MySqlEvalVisitorImpl`) (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.alibaba.druid.sql.dialect.odps.ast` (`OdpsObjectImpl`, `OdpsStatementImpl`) (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.alibaba.druid.sql.dialect.oracle.ast` (`OracleSQLObjectImpl`, `OracleSegmentAttributesImpl`) (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.alibaba.druid.sql.dialect.oracle.ast.stmt` (`OracleStatementImpl`) (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.alibaba.druid.sql.dialect.oscar.ast` (`OscarObjectImpl`) (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.alibaba.druid.sql.dialect.phoenix.ast` (`PhoenixStatementImpl`) (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.alibaba.druid.sql.dialect.postgresql.ast` (`PGSQLObjectImpl`) (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.alibaba.druid.sql.dialect.postgresql.ast.expr` (`PGExprImpl`) (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.alibaba.druid.sql.dialect.redshift.stmt` (`RedshiftObjectImpl`) (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.alibaba.druid.sql.dialect.sqlserver.ast` (`SQLServerObjectImpl`, `SQLServerStatementImpl`) (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.alibaba.druid.sql.visitor` (`SQLEvalVisitorImpl`) (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.alibaba.druid.support.http` (`AbstractWebStatImpl`) (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.alibaba.druid.support.jakarta` (`AbstractWebStatImpl`) (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.alibaba.druid.support.logging` (`JakartaCommonsLoggingImpl`, `Jdk14LoggingImpl`, `Log4j2Impl`, `Log4jImpl`, `NoLoggingImpl`, `SLF4JImpl`) (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.alibaba.druid.support.monitor.dao` (`MonitorDaoJdbcImpl`) (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.alibaba.druid.wall` (`WallProviderStatLoggerImpl`) (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.
Only 6/7 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `druid-demo-petclinic`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
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 2 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. — REDACTED:10
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.
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.
Deployment is orchestrated by compose, but no service declares a `healthcheck:` and nothing pins a previous image to fall back to — the runtime can tell that the container is up, not that it is serving, so a bad release is harder to detect and reverse.
What to do
Add a `healthcheck:` to the served compose service — probing the endpoint it already answers on where it has one — with `depends_on: condition: service_healthy` on whatever waits for it, and keep the deployed image tag immutable and recorded so rolling back is re-pointing at the previous tag rather than rebuilding.
Add an approval/environment gate (required reviewers / protection rules) before production promotion.
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.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`HttpClients.createDefault(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — druid-admin/src/main/java/com/alibaba/druid/admin/util/HttpUtil.java:22
What to do
Set connect and read timeouts on every client (`RestTemplateBuilder.connectTimeout/readTimeout`, WebClient `responseTimeout`, `HttpRequest.Builder.timeout`, `HttpURLConnection.setReadTimeout`, Feign `connectTimeout`/`readTimeout` in configuration), and wrap calls to dependencies in resilience4j `@Retry`/`@CircuitBreaker`/`@TimeLimiter` (or Spring Retry).
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
A JMH/Jetpack Benchmark suite exists but nothing turns on its allocation measurement — allocations (the main way hot code pressures a garbage collector or allocator) aren't being measured. — core/src/test/java/com/alibaba/druid/bvt/pool/UsingDefaultLockModeBenchmarkTest.java
What to do
Run JMH with the GC profiler (`-prof gc`, or addProfiler(GCProfiler.class)) so allocation rate regressions are visible, not just time.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
0 typed · 6 plain JS — the untyped files are core/src/main/resources/support/http/resources/js/common.js, REDACTED, core/src/main/resources/support/http/resources/js/lang.js, druid-admin/src/main/resources/support/http/resources/js/common.js, REDACTED, druid-admin/src/main/resources/support/http/resources/js/lang.js.
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
core/src/main/resources/support/http/resources/js/lang.js:1 · druid-admin/src/main/resources/support/http/resources/js/lang.js:1 — these 2 files are line-for-line copies of one another — 332 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — core/src/main/resources/support/http/resources/js/lang.js:1
core/src/main/resources/support/http/resources/js/common.js:1 · druid-admin/src/main/resources/support/http/resources/js/common.js:1 — these 2 files are line-for-line copies of one another — 129 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — core/src/main/resources/support/http/resources/js/common.js:1
REDACTED:5 · REDACTED:5 — these 2 files are line-for-line copies of one another — 94 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — REDACTED:5
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
template has cyclomatic complexity 16 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×2) — REDACTED:94, REDACTED:87
Do you agree with this assessment?
R3 · Large Files10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
Do you agree with this assessment?
R7 · Dead Code10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
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.
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.
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 controlled by an `if`, 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)`). Deterministic, provable per finding. Advisory.
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.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped2.7 / 10Weak✓ Tool-verified
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
`html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×4) — core/src/main/resources/support/http/resources/js/common.js:107, core/src/main/resources/support/http/resources/js/common.js:119, druid-admin/src/main/resources/support/http/resources/js/common.js:114, …
What to do
Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
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.
Do you agree with this assessment?
X27 · Collection changed while being enumerated7.6 / 10Strong✓ Tool-verified
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.
`this.tables` is enumerated directly, and line 153 calls `this.tables.add(…)` inside the loop body — a structural change to a `ArrayList`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen. — core/src/main/java/com/alibaba/druid/wall/WallProviderStatValue.java:151
`this.functions` is enumerated directly, and line 162 calls `this.functions.add(…)` inside the loop body — a structural change to a `ArrayList`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen. — core/src/main/java/com/alibaba/druid/wall/WallProviderStatValue.java:160
`this.blackList` is enumerated directly, and line 170 calls `this.blackList.add(…)` inside the loop body — a structural change to a `ArrayList`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen. — core/src/main/java/com/alibaba/druid/wall/WallProviderStatValue.java:169
`this.whiteList` is enumerated directly, and line 178 calls `this.whiteList.add(…)` inside the loop body — a structural change to a `ArrayList`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen. — core/src/main/java/com/alibaba/druid/wall/WallProviderStatValue.java:177
`supportOptions` is enumerated directly, and line 74 calls `supportOptions.add(…)` inside the loop body — a structural change to a `HashSet`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen. — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:73
What to do
Each finding names the two spans that cannot both stand — the enhanced `for` source, and the call inside the body that structurally changes that same collection. Confirm from those two, then pick one: remove through the iterator itself (`Iterator<T> it = c.iterator(); … it.remove();`) or replace the loop with `c.removeIf(…)`; iterate a copy (`for (T x : new ArrayList<>(c))`); collect what needs changing and apply it after the loop; or — where the loop was only ever meant to act on the first match — `break` immediately after the mutation, which is the one shape that is already safe.
Do you agree with this assessment?
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.
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. (×10) — core/src/main/java/com/alibaba/druid/DbType.java:156, core/src/main/java/com/alibaba/druid/support/ibatis/IbatisUtils.java:108, core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:915, …
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. (×10) — core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:116, REDACTED:553, core/src/main/java/com/alibaba/druid/support/opds/udf/ExportTables.java:61, …
`catch (Throwable)` 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. (×10) — core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:378, core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:407, core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:429, …
What to do
Swallowed exception (caught, then discarded)
Do you agree with this assessment?
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.
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.
`info` at line 54 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.info("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. — druid-admin/src/main/java/com/alibaba/druid/admin/service/K8sDiscoveryClient.java:54
`info` at line 393 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.info("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. — druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:393
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/217 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).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
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.
Unscored — 3 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.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 2 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 — 51 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.
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) 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
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 — The runtime tier booted this repository's service, but crawled PUBLIC routes only — add a Playwright storageState (e.g. playwright/.auth/user.json) or a test auth-setup to crawl authenticated screens rendered 0/1 surface(s) × 2 renders render failed for http://127.0.0.1:3306: page.goto: net::ERR_CONNECTION_RESET at http://127.0.0.1:3306/
Call log:
- navigating to "http://127.0.0.1:3306/", waiting until "load"
rendered 0/1 surface(s) × 2 renders render failed for http://127.0.0.1:5432: page.goto: net::ERR_EMPTY_RESPONSE at http://127.0.0.1:5432/
Call log:
- navigating to "http://127.0.0.1:5432/", waiting until "load"
. This repository also has a user interface (52 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates) that the booted service does not serve, and this scan has no strategy that reaches it — so no WCAG success criterion was verified in a rendered page on this run. That is a gap in OUR tooling, not a finding about your application: nothing here says the interface is inaccessible. The static accessibility checks still ran.
AXS1 Runtime exposed surface — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
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.
D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; Java, JavaScript, html not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Java surface was not measured.
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 — 6 of 12 comment blocks were not judged (6 in a non-Latin script): redundancy is judged by word overlap with the code's identifiers, which cannot be measured across languages.
D25 ADR Conformance — no ADRs to check
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.
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.
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): 38 value object(s); 2 repository port(s) loading or saving an aggregate/entity
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
P8 Schema migrations — Hibernate is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
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
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.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R4 Test Coverage — the JS/TS workspace (6 production file(s)) has no JavaScript/TypeScript test, but it is 1.21% of this repository's production source and the other 98.79% carries 230,695 line(s) of test code this pass cannot read — an incidental frontend's reachability is not the repository's test posture, so it is not scored as one
R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
R6 Tooling — no package.json in the repository — test/lint/typecheck wiring is read from package.json scripts (corroborated against CI), so this project's own toolchain isn't measured here
R8 Dependency Hygiene — Not measured — no package.json declares any dependency, so there is nothing to check imports against (imports may resolve through a host runtime rather than node).
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
X12 Unreachable branch — X12 reached only 1% of this repository's production lines — java (272,789 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — 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
X19 Unrestored process-global state — 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
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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
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
X29 Per-element action decided by a fixed element — 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.
AC2 · Forms & labels· <input> without a programmatic label · ×17
<input> without a programmatic label core/src/main/resources/support/http/resources/login.html:61— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label core/src/main/resources/support/http/resources/login.html:64— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label druid-admin/src/main/resources/support/http/resources/login.html:58— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label druid-admin/src/main/resources/support/http/resources/login.html:61— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/fragments/inputField.html:11— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/fragments/inputField.html:12— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/owners/createOrUpdateOwnerForm.html:9— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/owners/createOrUpdateOwnerForm.html:11— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/owners/createOrUpdateOwnerForm.html:13— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/owners/createOrUpdateOwnerForm.html:15— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/owners/createOrUpdateOwnerForm.html:17— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/owners/findOwners.html:14— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/pets/createOrUpdatePetForm.html:19— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/pets/createOrUpdatePetForm.html:21— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/pets/createOrUpdatePetForm.html:23— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/pets/createOrUpdateVisitForm.html:33— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label druid-demo-petclinic/src/main/resources/templates/pets/createOrUpdateVisitForm.html:35— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<html> without a lang core/src/main/resources/support/http/resources/activeConnectionStackTrace.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/api.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang REDACTED:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/datasource.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/index.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/nopermit.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/spring-detail.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/spring.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/sql-detail.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/sql.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/wall.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/webapp.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/websession-detail.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang core/src/main/resources/support/http/resources/websession.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
D10 · Test Quality· Assertions commented out · ×12
Assertions commented out: test_0 core/src/test/java/com/alibaba/druid/bvt/pool/Issue4316.java:9— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_parameterized core/src/test/java/com/alibaba/druid/bvt/sql/lexer/LexerParameterizedTest.java:11— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_q01 core/src/test/java/com/alibaba/druid/bvt/sql/mysql/resolve/TPCDS_ALL_Resolve.java:30— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_statService_getDataSourceIdList core/src/test/java/com/alibaba/druid/bvt/stat/DruidStatServiceTest.java:164— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_statService_getDataSourceList core/src/test/java/com/alibaba/druid/bvt/stat/DruidStatServiceTest2.java:158— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_schemaStat core/src/test/java/com/alibaba/druid/demo/sql/SchemaStatTest_odps.java:21— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_idle core/src/test/java/com/alibaba/druid/pool/dbcp/Test0.java:28— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_idle core/src/test/java/com/alibaba/druid/pool/dbcp/TestIdleForKylin.java:31— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_concurrent_2 core/src/test/java/com/alibaba/druid/pool/ConcurrentTest2.java:52— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: testBuildSql core/src/test/java/com/alibaba/druid/pvt/support/monitor/MonitorDaoJdbcImplTest.java:42— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: testCreateTable core/src/test/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParserTest.java:226— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
Assertions commented out: test_false core/src/test/java/com/alibaba/druid/test/wall/MySqlResourceWallTest.java:30— The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
AC2 · Forms & labels· <label> that labels no control · ×4
<label> that labels no control druid-demo-petclinic/src/main/resources/templates/fragments/inputField.html:8— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control druid-demo-petclinic/src/main/resources/templates/fragments/selectField.html:8— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control druid-demo-petclinic/src/main/resources/templates/owners/findOwners.html:12— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control druid-demo-petclinic/src/main/resources/templates/pets/createOrUpdatePetForm.html:14— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
D10 · Test Quality· No assertions (empty test) · ×4
No assertions (empty test): test_execute core/src/test/java/com/alibaba/druid/bvt/filter/ReuseStatFilterTest.java:32— Test method has an empty body — it asserts nothing and exercises no code.
No assertions (empty test): test_closeError core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_closeError.java:41— Test method has an empty body — it asserts nothing and exercises no code.
No assertions (empty test): test core/src/test/java/com/alibaba/druid/bvt/sql/mysql/param/MySQLParameterizedTest.java:36— Test method has an empty body — it asserts nothing and exercises no code.
No assertions (empty test): test core/src/test/java/com/alibaba/druid/bvt/AlipayUseCaseTest.java:45— Test method has an empty body — it asserts nothing and exercises no code.
Orphaned knowledge core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
AC1 · Text alternatives· <img> without a text alternative · ×3
<img> without a text alternative core/src/main/resources/support/http/resources/js/common.js:32— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative druid-demo-petclinic/src/main/resources/templates/error.html:6— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative druid-demo-petclinic/src/main/resources/templates/welcome.html:10— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
AC2 · Forms & labels· <textarea> without a programmatic label · ×2
<textarea> without a programmatic label core/src/main/resources/support/http/resources/sql-detail.html:23— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<textarea> without a programmatic label druid-admin/src/main/resources/support/http/resources/sql-detail.html:23— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels· <select> without a programmatic label · ×1
<select> without a programmatic label druid-demo-petclinic/src/main/resources/templates/fragments/selectField.html:11— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC3 · Page structure· Document <title> is empty · ×1
Document <title> is empty core/src/main/resources/support/http/resources/nopermit.html:2— An empty <title> gives no page name in the tab, history or screen-reader page list. Put descriptive text in the <title>.
Banned license: com.mysql:mysql-connector-j — `com.mysql:mysql-connector-j` 8.0.33 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.
TodoComment core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:62— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:67— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:72— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:77— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:82— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:87— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:189— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:194— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:199— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:204— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:209— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:214— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:219— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:224— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:229— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:234— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:239— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:244— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:249— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:254— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:258— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:264— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:269— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:274— // TODO Auto-generated method stub — 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 core/src/test/java/com/alibaba/druid/test/util/OracleMockConnection.java:279— // TODO Auto-generated method stub — 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.
No assertions: test_benchmark core/src/test/java/com/alibaba/druid/benckmark/pool/druid/DruidCase0.java:46— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_druid core/src/test/java/com/alibaba/druid/benckmark/pool/Case0.java:62— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_bonecp core/src/test/java/com/alibaba/druid/benckmark/pool/Case1.java:138— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_c3p0 core/src/test/java/com/alibaba/druid/benckmark/pool/Case1.java:165— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_dbcp core/src/test/java/com/alibaba/druid/benckmark/pool/Case1.java:115— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_druid core/src/test/java/com/alibaba/druid/benckmark/pool/Case1.java:92— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_tomcat_jdbc core/src/test/java/com/alibaba/druid/benckmark/pool/Case1.java:186— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_0 core/src/test/java/com/alibaba/druid/benckmark/pool/Case2.java:63— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_1 core/src/test/java/com/alibaba/druid/benckmark/pool/Case2.java:86— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_perf core/src/test/java/com/alibaba/druid/benckmark/pool/CaseKylin_Oracle.java:78— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_perf core/src/test/java/com/alibaba/druid/benckmark/pool/CaseKylin_mysql.java:75— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_perf core/src/test/java/com/alibaba/druid/benckmark/pool/CaseKylin_mysql_idle_1.java:74— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_perf core/src/test/java/com/alibaba/druid/benckmark/pool/CaseKylin_mysql_idle_2.java:77— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_0 core/src/test/java/com/alibaba/druid/benckmark/pool/Case_Concurrent_50.java:59— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_1 core/src/test/java/com/alibaba/druid/benckmark/pool/Case_Concurrent_50.java:85— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_0 core/src/test/java/com/alibaba/druid/benckmark/pool/Oracle_Case0.java:55— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_1 core/src/test/java/com/alibaba/druid/benckmark/pool/Oracle_Case0.java:78— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_2 core/src/test/java/com/alibaba/druid/benckmark/pool/Oracle_Case0.java:101— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_0 core/src/test/java/com/alibaba/druid/benckmark/pool/Oracle_Case3.java:56— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_1 core/src/test/java/com/alibaba/druid/benckmark/pool/Oracle_Case3.java:78— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_dbcp core/src/test/java/com/alibaba/druid/benckmark/pool/Oracle_Case4.java:100— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_druid core/src/test/java/com/alibaba/druid/benckmark/pool/Oracle_Case4.java:71— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_druid_benchmark core/src/test/java/com/alibaba/druid/benckmark/proxy/DruidBenchmarkTest.java:23— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_0 core/src/test/java/com/alibaba/druid/benckmark/proxy/TestAtomicPerformance.java:24— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: test_perf core/src/test/java/com/alibaba/druid/benckmark/sql/MySqlInsertBenchmark.java:21— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, or through a harness that fails by throwing under some other name is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
TooManyMethods: SQLASTOutputVisitor core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:67— TooManyMethods — 567 methods. The bar is 30 methods; this is 537 over it, 18.90× 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: FilterChainImpl core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:36— TooManyMethods — 496 methods. The bar is 30 methods; this is 466 over it, 16.53× the bar. Most of these members implement filter.FilterChain (295 of 300 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: FilterAdapter core/src/main/java/com/alibaba/druid/filter/FilterAdapter.java:38— TooManyMethods — 488 methods. The bar is 30 methods; this is 458 over it, 16.27× the bar. Most of these members implement filter.Filter (294 of 294 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: DruidAbstractDataSource core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:63— TooManyMethods — 262 methods. The bar is 30 methods; this is 232 over it, 8.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: SQLStatementParser core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:49— TooManyMethods — 246 methods. The bar is 30 methods; this is 216 over it, 8.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: MySqlOutputVisitor core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:41— TooManyMethods — 225 methods. The bar is 30 methods; this is 195 over it, 7.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: ResultSetProxyImpl core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:33— TooManyMethods — 219 methods. The bar is 30 methods; this is 189 over it, 7.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: SchemaStatVisitor core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:42— TooManyMethods — 207 methods. The bar is 30 methods; this is 177 over it, 6.90× 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: SQLExprParser core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:41— TooManyMethods — 199 methods. The bar is 30 methods; this is 169 over it, 6.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: DruidPooledResultSet core/src/main/java/com/alibaba/druid/pool/DruidPooledResultSet.java:27— TooManyMethods — 194 methods. The bar is 30 methods; this is 164 over it, 6.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: ResultSetBase core/src/main/java/com/alibaba/druid/util/jdbc/ResultSetBase.java:26— TooManyMethods — 192 methods. The bar is 30 methods; this is 162 over it, 6.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: DatabaseMetaDataProxyImpl core/src/main/java/com/alibaba/druid/proxy/jdbc/DatabaseMetaDataProxyImpl.java:23— TooManyMethods — 177 methods. The bar is 30 methods; this is 147 over it, 5.90× 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: WallConfig core/src/main/java/com/alibaba/druid/wall/WallConfig.java:28— TooManyMethods — 166 methods. The bar is 30 methods; this is 136 over it, 5.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.
TooManyMethods: PGOutputVisitor core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:44— TooManyMethods — 163 methods. The bar is 30 methods; this is 133 over it, 5.43× 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: WallFilter core/src/main/java/com/alibaba/druid/wall/WallFilter.java:44— TooManyMethods — 161 methods. The bar is 30 methods; this is 131 over it, 5.37× the bar. Most of these members implement filter.Filter (97 of 127 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: SQLCreateTableStatement core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:37— TooManyMethods — 152 methods. The bar is 30 methods; this is 122 over it, 5.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.
TooManyMethods: MySqlSchemaStatVisitor core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlSchemaStatVisitor.java:37— TooManyMethods — 151 methods. The bar is 30 methods; this is 121 over it, 5.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: DruidDataSource core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:81— TooManyMethods — 144 methods. The bar is 30 methods; this is 114 over it, 4.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: MySqlStatementParser core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:50— TooManyMethods — 132 methods. The bar is 30 methods; this is 102 over it, 4.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: OracleOutputVisitor core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:46— TooManyMethods — 130 methods. The bar is 30 methods; this is 100 over it, 4.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: WebAppStatValue core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatValue.java:26— TooManyMethods — 128 methods. The bar is 30 methods; this is 98 over it, 4.27× 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: SQLUtils core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:95— TooManyMethods — 127 methods. The bar is 30 methods; this is 97 over it, 4.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.
TooManyMethods: SQLSelectQueryBlock core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:32— TooManyMethods — 127 methods. The bar is 30 methods; this is 97 over it, 4.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.
TooManyMethods: OscarOutputVisitor core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:40— TooManyMethods — 124 methods. The bar is 30 methods; this is 94 over it, 4.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.
TooManyMethods: Lexer core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:41— TooManyMethods — 120 methods. The bar is 30 methods; this is 90 over it, 4.00× 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.
MethodTooLong: OracleStatementParser.parseStatementList core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:69— MethodTooLong — parseStatementList 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: SQLSelectParser.parseTableSourceRest core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1601— MethodTooLong — parseTableSourceRest runs 432 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 332 over it, 4.32× 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: MySqlUtils.parseDateTime core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1436— MethodTooLong — parseDateTime runs 380 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 280 over it, 3.80× 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: OdpsStatementParser.parseStatementListDialect core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:84— MethodTooLong — parseStatementListDialect runs 373 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 273 over it, 3.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: MySqlCreateTableParser.parseCreateTable core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:91— MethodTooLong — parseCreateTable runs 352 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 252 over it, 3.52× 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: MySqlUtils.parseDate core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:978— MethodTooLong — parseDate runs 347 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 247 over it, 3.47× 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: OdpsCreateTableParser.parseCreateTable core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:39— MethodTooLong — parseCreateTable runs 319 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 219 over it, 3.19× 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: SQLEvalVisitorUtils.visit core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:184— MethodTooLong — visit runs 296 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 196 over it, 2.96× 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: MySqlExprParser.primary core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:915— MethodTooLong — primary runs 291 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 191 over it, 2.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: MySqlCreateTableParser.parseOptions core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:628— MethodTooLong — parseOptions runs 287 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 187 over it, 2.87× 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: SQLStatementParser.parseStatementList core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:131— MethodTooLong — parseStatementList runs 285 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 185 over it, 2.85× 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: OracleCreateTableParser.parseCreateTable core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:48— MethodTooLong — parseCreateTable 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: Lexer.scanSQLType core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:696— MethodTooLong — scanSQLType runs 266 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 166 over it, 2.66× 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: SQLStatementParser.parsePrivilege core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1709— MethodTooLong — parsePrivilege runs 251 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 151 over it, 2.51× 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: SQLTimestampExpr.check core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:256— MethodTooLong — check runs 246 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 146 over it, 2.46× 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: SQLStatementParser.parseValueClauseNative core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6057— MethodTooLong — parseValueClauseNative runs 246 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 146 over it, 2.46× 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: SQLUtils.acceptTableSource core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:998— MethodTooLong — acceptTableSource runs 225 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 125 over it, 2.25× 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: Lexer.nextToken core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1252— MethodTooLong — nextToken runs 220 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 120 over it, 2.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: MySqlExprParser.parseSelectItemRest core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:564— MethodTooLong — parseSelectItemRest runs 215 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 115 over it, 2.15× 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: WebAppStat.computeUserAgent core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:524— MethodTooLong — computeUserAgent runs 212 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× 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: SQLStatementParser.parseValueClause core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6388— MethodTooLong — parseValueClause runs 202 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 102 over it, 2.02× 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: OracleStatementParser.parserParameters core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2005— MethodTooLong — parserParameters runs 199 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 99 over it, 1.99× 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: Lexer.scanOperator core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1527— MethodTooLong — scanOperator runs 194 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 94 over it, 1.94× 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: SQLStatementParser.parseValueClause core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6662— MethodTooLong — parseValueClause 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: SQLEvalVisitorUtils.visit core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:958— MethodTooLong — visit runs 180 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× 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.
ClassTooLong: SQLASTOutputVisitor core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:67— ClassTooLong — 8233 significant lines (blank, comment-only and punctuation-only lines excluded), 567 methods. The bar is 400 significant lines; this is 7833 over it, 20.58× 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: SQLStatementParser core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:49— ClassTooLong — 5436 significant lines (blank, comment-only and punctuation-only lines excluded), 246 methods. The bar is 400 significant lines; this is 5036 over it, 13.59× 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: MySqlOutputVisitor core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:41— ClassTooLong — 3724 significant lines (blank, comment-only and punctuation-only lines excluded), 225 methods. The bar is 400 significant lines; this is 3324 over it, 9.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: FilterChainImpl core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:36— ClassTooLong — 3439 significant lines (blank, comment-only and punctuation-only lines excluded), 496 methods. The bar is 400 significant lines; this is 3039 over it, 8.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: DruidDataSource core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:81— ClassTooLong — 2503 significant lines (blank, comment-only and punctuation-only lines excluded), 144 methods. The bar is 400 significant lines; this is 2103 over it, 6.26× 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: Lexer core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:41— ClassTooLong — 2482 significant lines (blank, comment-only and punctuation-only lines excluded), 120 methods. The bar is 400 significant lines; this is 2082 over it, 6.21× 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: OracleStatementParser core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:37— ClassTooLong — 2221 significant lines (blank, comment-only and punctuation-only lines excluded), 53 methods. The bar is 400 significant lines; this is 1821 over it, 5.55× 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: SchemaStatVisitor core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:42— ClassTooLong — 2051 significant lines (blank, comment-only and punctuation-only lines excluded), 207 methods. The bar is 400 significant lines; this is 1651 over it, 5.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: PGOutputVisitor core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:44— ClassTooLong — 2046 significant lines (blank, comment-only and punctuation-only lines excluded), 163 methods. The bar is 400 significant lines; this is 1646 over it, 5.12× 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: OracleOutputVisitor core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:46— ClassTooLong — 1961 significant lines (blank, comment-only and punctuation-only lines excluded), 130 methods. The bar is 400 significant lines; this is 1561 over it, 4.90× 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: MySqlExprParser core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:41— ClassTooLong — 1897 significant lines (blank, comment-only and punctuation-only lines excluded), 49 methods. The bar is 400 significant lines; this is 1497 over it, 4.74× 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: FilterAdapter core/src/main/java/com/alibaba/druid/filter/FilterAdapter.java:38— ClassTooLong — 1861 significant lines (blank, comment-only and punctuation-only lines excluded), 488 methods. The bar is 400 significant lines; this is 1461 over it, 4.65× 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: SQLSelectParser core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:33— ClassTooLong — 1722 significant lines (blank, comment-only and punctuation-only lines excluded), 58 methods. The bar is 400 significant lines; this is 1322 over it, 4.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: OracleExprParser core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:40— ClassTooLong — 1557 significant lines (blank, comment-only and punctuation-only lines excluded), 39 methods. The bar is 400 significant lines; this is 1157 over it, 3.89× 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: OscarOutputVisitor core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:40— ClassTooLong — 1545 significant lines (blank, comment-only and punctuation-only lines excluded), 124 methods. The bar is 400 significant lines; this is 1145 over it, 3.86× 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: SchemaResolveVisitorFactory core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:53— ClassTooLong — 1514 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 1114 over it, 3.79× 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: SQLUtils core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:95— ClassTooLong — 1512 significant lines (blank, comment-only and punctuation-only lines excluded), 127 methods. The bar is 400 significant lines; this is 1112 over it, 3.78× 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: MySqlUtils core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:36— ClassTooLong — 1491 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. The bar is 400 significant lines; this is 1091 over it, 3.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.
ClassTooLong: DruidAbstractDataSource core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:63— ClassTooLong — 1392 significant lines (blank, comment-only and punctuation-only lines excluded), 262 methods. The bar is 400 significant lines; this is 992 over it, 3.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: SQLEvalVisitorUtils core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:47— ClassTooLong — 1334 significant lines (blank, comment-only and punctuation-only lines excluded), 52 methods. The bar is 400 significant lines; this is 934 over it, 3.34× 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: CalciteMySqlNodeVisitor core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java:25— ClassTooLong — 1312 significant lines (blank, comment-only and punctuation-only lines excluded), 72 methods. The bar is 400 significant lines; this is 912 over it, 3.28× 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: SQLASTVisitor core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTVisitor.java:40— ClassTooLong — 1263 significant lines (blank, comment-only and punctuation-only lines excluded), 792 methods. The bar is 400 significant lines; this is 863 over it, 3.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: ResultSetProxyImpl core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:33— ClassTooLong — 1168 significant lines (blank, comment-only and punctuation-only lines excluded), 219 methods. The bar is 400 significant lines; this is 768 over it, 2.92× 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: OdpsStatementParser core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:45— ClassTooLong — 1168 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 768 over it, 2.92× 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: DruidPooledResultSet core/src/main/java/com/alibaba/druid/pool/DruidPooledResultSet.java:27— ClassTooLong — 1160 significant lines (blank, comment-only and punctuation-only lines excluded), 194 methods. The bar is 400 significant lines; this is 760 over it, 2.90× 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.
FileTooLong: visitor/SQLASTOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java— FileTooLong — 8280 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: SQLASTOutputVisitor (67-12536). The bar is 500 significant lines; this is 7780 over it, 16.56× 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: parser/MySqlStatementParser.java core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java— FileTooLong — 5735 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5235 over it, 11.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: parser/SQLStatementParser.java core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java— FileTooLong — 5465 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: SQLStatementParser (49-7983). The bar is 500 significant lines; this is 4965 over it, 10.93× 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: parser/SQLExprParser.java core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java— FileTooLong — 4815 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4315 over it, 9.63× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: visitor/MySqlOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java— FileTooLong — 3746 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: MySqlOutputVisitor (41-5722). The bar is 500 significant lines; this is 3246 over it, 7.49× 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: filter/FilterChainImpl.java core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java— FileTooLong — 3453 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: FilterChainImpl (36-5287). The bar is 500 significant lines; this is 2953 over it, 6.91× 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: pool/DruidDataSource.java core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java— FileTooLong — 2560 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: DruidDataSource (81-3991). The bar is 500 significant lines; this is 2060 over it, 5.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: parser/Lexer.java core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java— FileTooLong — 2500 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: Lexer (41-3524). The bar is 500 significant lines; this is 2000 over it, 5.00× 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: parser/OracleStatementParser.java core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java— FileTooLong — 2238 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: OracleStatementParser (37-3175). The bar is 500 significant lines; this is 1738 over it, 4.48× 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: visitor/SchemaStatVisitor.java core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java— FileTooLong — 2074 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: SchemaStatVisitor (42-3341). The bar is 500 significant lines; this is 1574 over it, 4.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: visitor/PGOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java— FileTooLong — 2071 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: PGOutputVisitor (44-3126). The bar is 500 significant lines; this is 1571 over it, 4.14× 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: visitor/OracleOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java— FileTooLong — 1988 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: OracleOutputVisitor (46-3011). The bar is 500 significant lines; this is 1488 over it, 3.98× 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: parser/MySqlExprParser.java core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java— FileTooLong — 1919 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: MySqlExprParser (41-2689). The bar is 500 significant lines; this is 1419 over it, 3.84× 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: filter/FilterAdapter.java core/src/main/java/com/alibaba/druid/filter/FilterAdapter.java— FileTooLong — 1874 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: FilterAdapter (38-2891). The bar is 500 significant lines; this is 1374 over it, 3.75× 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: parser/SQLSelectParser.java core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java— FileTooLong — 1735 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: SQLSelectParser (33-2554). The bar is 500 significant lines; this is 1235 over it, 3.47× 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: spi/WallVisitorUtils.java core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java— FileTooLong — 1732 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1232 over it, 3.46× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: sql/SQLUtils.java core/src/main/java/com/alibaba/druid/sql/SQLUtils.java— FileTooLong — 1588 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: SQLUtils (95-2609). The bar is 500 significant lines; this is 1088 over it, 3.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: parser/OracleExprParser.java core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java— FileTooLong — 1578 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: OracleExprParser (40-2184). The bar is 500 significant lines; this is 1078 over it, 3.16× 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: visitor/OscarOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java— FileTooLong — 1566 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: OscarOutputVisitor (40-2397). The bar is 500 significant lines; this is 1066 over it, 3.13× 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: repository/SchemaResolveVisitorFactory.java core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java— FileTooLong — 1548 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: SchemaResolveVisitorFactory (53-2466). The bar is 500 significant lines; this is 1048 over it, 3.10× 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: util/MySqlUtils.java core/src/main/java/com/alibaba/druid/util/MySqlUtils.java— FileTooLong — 1507 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: MySqlUtils (36-1995). The bar is 500 significant lines; this is 1007 over it, 3.01× 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: pool/DruidAbstractDataSource.java core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java— FileTooLong — 1430 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: DruidAbstractDataSource (63-2389). The bar is 500 significant lines; this is 930 over it, 2.86× 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: visitor/SQLEvalVisitorUtils.java core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java— FileTooLong — 1361 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: SQLEvalVisitorUtils (47-2167). The bar is 500 significant lines; this is 861 over it, 2.72× 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: calcite/CalciteMySqlNodeVisitor.java core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java— FileTooLong — 1333 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: CalciteMySqlNodeVisitor (25-1844). The bar is 500 significant lines; this is 833 over it, 2.67× 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: visitor/SQLASTVisitor.java core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTVisitor.java— FileTooLong — 1282 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: SQLASTVisitor (40-2925). The bar is 500 significant lines; this is 782 over it, 2.56× 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.
Duplicated block (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:469— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:469-478 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:501-510 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:498` calls `accept` and `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:467` 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:181— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:181-190 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsNewExpr.java:35-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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:181` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:320— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:320-329 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:386-395 — 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:78— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:78-87 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:78-87 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 74 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:99— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:99-108 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:99-108 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 74 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:177— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:177-186 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:249-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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:177` 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:743— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:743-752 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:251-260 — 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:393— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:393-402 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUpdateStatement.java:152-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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:393` 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:80— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:80-89 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:812-821 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:80` 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:69— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:69-78 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:271-280 — 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:51— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:51-60 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:73-82 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:51` 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: `ForClause` names `com.alibaba.druid.sql.dialect.dm.ast.stmt.DmSelectQueryBlock.ForClause` in one and `com.alibaba.druid.sql.dialect.oscar.ast.stmt.OscarSelectQueryBlock.ForClause` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:61` calls `getWaitTimeout`, `print0`, `accept` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:83` 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:58— core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:58-67 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1482-1491 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.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.
Duplicated block (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterEventStatement.java:42— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterEventStatement.java:42-51 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateEventStatement.java:142-151 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterEventStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateEventStatement.java` as WHOLE FILES: 94% 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. 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:635— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:635-644 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:656-665 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:635` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:74— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:74-83 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:66-75 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:74` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:375— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:375-384 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:393-402 — 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:418— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:418-427 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:433-442 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:418` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1048— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1048-1057 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2279-2288 — 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 `x` to `MySqlDeleteStatement` in one and `MySqlUpdateStatement` 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3620— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3620-3629 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2841-2850 — 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4245— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4245-4254 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4262-4271 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4245` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLIfStatement.ElseIf` in one and `SQLIfStatement.Else` 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4355— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4355-4364 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9139-9148 — 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5121— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5121-5130 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5270-5279 — 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 `x` to `MySqlCreateTableSpaceStatement` in one and `MySqlAlterTablespaceStatement` 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:141— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:141-150 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:197-206 — 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:362— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:362-371 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1623-1632 — 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 (10 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:436— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:436-445 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:455-464 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:436` 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLOrderBy.java:67— core/src/main/java/com/alibaba/druid/sql/ast/SQLOrderBy.java:67-75 | core/src/main/java/com/alibaba/druid/sql/ast/SQLZOrderBy.java:67-75 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/SQLOrderBy.java` and `core/src/main/java/com/alibaba/druid/sql/ast/SQLZOrderBy.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 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 (9 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:841— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:841-849 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:874-882 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:841` 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:227— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:227-235 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1261-1269 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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 × 2) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:113— core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:113-121 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11134-11142 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:113` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11144` calls `isMysqlDbType`, `isPgsqlDbType` and `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:122` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:291— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:291-299 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:92-100 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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 × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:457— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:457-465 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:139-147 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:457` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1760— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1760-1768 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1850-1858 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1809— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1809-1817 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1831-1840 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1831` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1831— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1831-1839 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1874-1882 — 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 (9 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4328— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4328-4336 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4398-4406 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4328` 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 `x` to `SQLLoopStatement` in one and `MySqlRepeatStatement` 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) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:797— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:797-805 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:922-930 — 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 `x` to `OdpsAddTableStatement` in one and `OdpsCountStatement` 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) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1286— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1286-1294 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2384-2392 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1286` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:229— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:229-237 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:255-263 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:229` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:795— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:795-803 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:807-815 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2188— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2188-2196 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2214-2222 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2197` calls `accept`, `setReturnDataType`, `parseDataType` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2224` 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 (9 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/stmt/RedshiftSelectQueryBlock.java:67— core/src/main/java/com/alibaba/druid/sql/dialect/redshift/stmt/RedshiftSelectQueryBlock.java:67-75 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/SQLServerSelectQueryBlock.java:66-74 — 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 `visitor` to `RedshiftASTVisitor` in one and `SQLServerASTVisitor` 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) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:241— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:241-249 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:251-259 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:241` 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) core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:174— core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:174-182 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:6491-6499 — 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 (9 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:896— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:896-904 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:991-999 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2740— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2740-2748 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2795-2803 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2740` 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3551— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3551-3559 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3655-3663 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3551` 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:771— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:771-779 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:1098-1106 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:771` 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6157— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6157-6165 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6438-6446 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6157` 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) core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:330— core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:330-338 | core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:357-365 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:330` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:353` calls `parameterize`, `StringBuilder`, `createParameterizedOutputVisitor` and `core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:328` 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6262— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6262-6271 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6888-6896 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6888` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLCreateIndexStatement` in one and `SQLIndexDefinition` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:592— core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:592-602 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:626-636 — 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 `core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:592` 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.
Duplicated block (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:368— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:368-378 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:401-411 — 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:344— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:344-354 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:357-367 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:344` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:45— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:45-55 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java:59-69 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:45` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNumberExpr.java:137— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNumberExpr.java:137-147 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNumberExpr.java:150-160 — 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. 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSubqueryTableSource.java:96— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSubqueryTableSource.java:96-106 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectSubqueryTableSource.java:83-93 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSubqueryTableSource.java:96` 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 `x` to `SQLSubqueryTableSource` in one and `OracleSelectSubqueryTableSource` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:336— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:336-346 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2117-2127 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:186— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:186-196 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1285-1295 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:186` 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:54— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:54-64 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:131-141 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:88— core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:88-98 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:225-235 — 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 `x` to `DorisExprTableSource` in one and `SQLSubqueryTableSource` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:88— core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:88-98 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:307-317 — 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 `x` to `DorisExprTableSource` in one and `OracleSelectJoin` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:138— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:138-148 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:237-247 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:138` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:59— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:59-69 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:128-138 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:59` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:254— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:254-264 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:76-86 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:254` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:265` calls `token` and `core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:87` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:105— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:105-115 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:216-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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:105` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `HiveInsert` in one and `HiveInsertStatement` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4085— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4085-4095 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4120-4130 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4117` calls `setWork` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4082` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4499— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4499-4509 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:497-507 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4499` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1016— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1016-1026 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1104-1114 — 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 `x` to `MySqlDeleteStatement` in one and `MySqlInsertStatement` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1028— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1028-1038 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1122-1132 — 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 `x` to `MySqlDeleteStatement` in one and `MySqlInsertStatement` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2407— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2407-2417 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2439-2449 — 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. 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 `x` to `MySqlShowCollationStatement` in one and `MySqlShowCharacterSetStatement` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3569— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3569-3579 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3673-3683 — 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. 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 `x` to `MySqlUseIndexHint` in one and `MySqlForceIndexHint` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:79— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:79-90 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:394-404 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:79` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1503— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1503-1513 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1537-1547 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1503` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java:49— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java:49-59 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGInsertStatement.java:47-57 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGInsertStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 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: the declarations holding them bind `x` to `OscarInsertStatement` in one and `PGInsertStatement` 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 (11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java:111— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java:111-121 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGInsertStatement.java:109-119 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGInsertStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 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: the declarations holding them bind `visitor` to `OscarASTVisitor` in one and `PGASTVisitor` 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) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:509— core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:509-516 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:535-542 — 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 `core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:509` 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:192— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:192-199 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:223-230 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java` as WHOLE FILES: this scan already matched 9 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:192` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:200` calls `setParent` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:231` 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 (8 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:71— core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:71-78 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3179-3186 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:71` 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 `x` to `DorisExprTableSource` in one and `SQLExprTableSource` 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) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:175— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:175-182 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:350-357 — 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 (8 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:386— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:386-393 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6277-6284 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:703— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:703-710 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:713-720 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:703` 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 after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:714` calls `acceptIdentifier` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:724` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:973— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:973-980 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:261-268 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:973` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:217— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:217-224 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5935-5942 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2980— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2980-2987 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3087-3094 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8459— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8459-8466 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:194-201 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8459` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9174— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9174-9181 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:247-254 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9174` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:851— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:851-858 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/visitor/PrestoOutputVisitor.java:190-197 — 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 `x` to `MySqlExecuteStatement` in one and `PrestoExecuteStatement` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5099— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5099-5106 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5266-5273 — 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 `x` to `MySqlCreateTableSpaceStatement` in one and `MySqlAlterTablespaceStatement` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:687— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:687-694 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1065-1072 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:687` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1073` calls `identifierEquals`, `nextToken`, `setToType` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:695` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1236— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1236-1243 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2604-2611 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1236` 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 (8 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1009— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1009-1016 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2813-2820 — 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 (8 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:179— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:179-186 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2060-2067 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:179` 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:587— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:587-594 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:617-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 `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:587` 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) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1206— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1206-1213 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1225-1232 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1206` 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 (8 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:770— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:770-777 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:942-949 — 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 (8 lines × 2) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1057— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1057-1064 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1066-1073 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1057` 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1564— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1564-1571 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1828-1835 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1564` 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, `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1826` calls `getFirstQueryBlock` and `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1562` 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 × 2) core/src/main/java/com/alibaba/druid/sql/visitor/functions/If.java:32— core/src/main/java/com/alibaba/druid/sql/visitor/functions/If.java:32-39 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Isnull.java:30-37 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:37— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:37-44 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Locate.java:47-54 — 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) core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:331— core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:331-338 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringMethodStat.java:159-166 — 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:603— core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:603-618 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:638-650 — 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 `core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:603` 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:680— core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:680-692 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:818-830 — 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 `core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:680` 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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:826— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:826-838 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1737-1749 — 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:236— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:236-248 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java:282-294 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 61 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:126— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:126-138 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:427-439 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:126` 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:107— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:107-119 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:237-249 — 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 `x` to `DmSelectQueryBlock` in one and `DmUpdateStatement` 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java:21— core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java:21-33 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java:179-191 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.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 after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java:192` calls `nextIf`, `SQLPartitionByValue` and `core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java:34` 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) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:90— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:90-102 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:144-156 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:90` 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 × 2) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:420— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:420-432 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:3084-3096 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:420` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:343— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:343-355 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:233-245 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:428— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:428-440 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9282-9294 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:428` 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 × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:855— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:855-867 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:869-881 — 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:632— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:632-644 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:948-960 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:632` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5268— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5268-5280 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5087-5099 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5268` 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 × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5304— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5304-5316 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5129-5141 — 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5809— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5809-5821 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5912-5924 — 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9327— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9327-9339 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9341-9353 — 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1792— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1792-1804 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1828-1840 — 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. 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 `x` to `DrdsCancelDDLJob` in one and `DrdsRollbackDDLJob` 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3690— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3690-3702 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3707-3719 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3690` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MySqlAlterTableChangeColumn` in one and `MySqlAlterTableModifyColumn` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3688` calls `getColumnName`, `accept` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3706` 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:121— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:121-133 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/visitor/SparkOutputASTVisitor.java:49-61 — 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 `x` to `SQLCreateTableStatement` in one and `SparkCreateTableStatement` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/spark/visitor/SparkOutputASTVisitor.java:62` calls `printUsing` and `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:134` 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:331— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:331-343 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2894-2906 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:331` 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) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:564— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:564-576 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:911-923 — 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 `x` to `OdpsReadStatement` in one and `OdpsCountStatement` 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:717— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:717-729 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:736-748 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:717` 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 × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1077— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1077-1089 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2862-2874 — 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 (13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeSelectParser.java:225— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeSelectParser.java:225-237 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeSelectParser.java:242-254 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeSelectParser.java:225` 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.
+ 18 more in this group — see findings.md.
AC4 · Keyboard semantics· Anchor without href · ×40
Anchor without href core/src/main/resources/support/http/resources/header.html:2— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring-detail.html:19— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring.html:48— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring.html:49— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring.html:50— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring.html:52— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring.html:53— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring.html:54— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring.html:55— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/spring.html:57— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql-detail.html:19— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:40— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:41— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:42— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:43— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:44— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:47— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:49— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:50— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:51— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:52— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:53— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:55— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:56— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Anchor without href core/src/main/resources/support/http/resources/sql.html:57— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
Duplicated block (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:708— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:708-719 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:726-737 — 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. 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:100— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:100-111 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:84-95 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 262 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:100` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:121— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:121-132 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:105-116 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 262 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:121` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:106— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:106-117 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIntervalExpr.java:120-131 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:106` 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:251— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:251-262 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropDatabaseStatement.java:120-131 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:251` 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:490— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:490-501 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9876-9887 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:82— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:82-93 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:54-65 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:82` 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 `x` to `DmSelectQueryBlock` in one and `SQLServerSelectQueryBlock` 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java:76— core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java:76-87 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerExprParser.java:223-234 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:425— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:425-436 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2623-2634 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java` and `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 187 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7675— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7675-7686 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:1022-1033 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7675` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2224— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2224-2235 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3875-3886 — 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 `x` to `MySqlUpdateStatement` in one and `SQLUpdateStatement` 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5326— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5326-5337 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3827-3838 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5326` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3840` calls `hasBeforeComment`, `printlnComments`, `getBeforeCommentsDirect` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5338` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:567— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:567-578 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:614-625 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:567` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1390— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1390-1401 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1491-1502 — 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1634— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1634-1645 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1649-1660 — 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:451— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:451-462 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:489-500 — 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:77— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:77-88 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:92-103 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:77` 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 first that the copies are not typed on the same thing: `ForClause` names `com.alibaba.druid.sql.dialect.oscar.ast.stmt.OscarSelectQueryBlock.ForClause` in one and `com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock.ForClause` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:494— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:494-505 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:858-869 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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: the declarations holding them bind `x` to `OscarAlterSchemaStatement` in one and `PGAlterSchemaStatement` 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:272— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:272-283 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:354-365 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.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. 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1228— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1228-1239 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1269-1280 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1228` 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) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftCreateTableParser.java:27— core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftCreateTableParser.java:27-38 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:48-59 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:787— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:787-798 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:864-875 — 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 (12 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2879— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2879-2890 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2920-2931 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2879` 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1144— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1144-1155 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1564-1575 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1144` 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6286— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6286-6297 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6951-6962 — 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 `x` to `SQLCreateIndexStatement` in one and `SQLIndexDefinition` 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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:460— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:460-465 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11958-11963 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:460` 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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:500— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:500-505 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11997-12002 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:500` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:61— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:61-66 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:707-712 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:61` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:87— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:87-92 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIntervalExpr.java:101-106 — 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 (6 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1666— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1666-1671 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1700-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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1666` 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:321— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:321-326 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoExprParser.java:96-101 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:321` 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:46— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:46-51 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:83-88 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 93 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:46` 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: `ForClause` names `com.alibaba.druid.sql.dialect.dm.ast.stmt.DmSelectQueryBlock.ForClause` in one and `com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock.ForClause` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:72— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:72-78 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:116-121 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:72` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1152— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1152-1158 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6534-6539 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1152` 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) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:77— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:77-82 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:122-127 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:77` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1693— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1693-1698 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1709-1714 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1693` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:95— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:95-100 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:115-120 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:95` 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 × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:620— core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:620-625 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5913-5918 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4753— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4753-4758 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7388-7393 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4753` 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 (6 lines × 2) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1188— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1188-1193 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1645-1650 — 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 `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1188` 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:833— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:833-838 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:861-866 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:833` 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:198— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:198-203 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:114-119 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:198` 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 `x` to `DmInsertStatement` in one and `SQLServerInsertStatement` 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) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2074— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2074-2079 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2195-2200 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3385— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3385-3390 | REDACTED:512-517 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3385` 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) core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:350— core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:350-355 | core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:358-363 — 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 `core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:350` 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLRowDataType.java:96— core/src/main/java/com/alibaba/druid/sql/ast/SQLRowDataType.java:96-101 | core/src/main/java/com/alibaba/druid/sql/ast/SQLStructDataType.java:97-102 — 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 (6 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:92— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:92-97 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTextLiteralExpr.java:42-47 — 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 (6 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNotExpr.java:75— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNotExpr.java:75-80 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleOuterExpr.java:86-91 — 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 (6 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:382— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:382-387 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:220-225 — 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 (6 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:335— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:335-340 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:876-881 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 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) core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:139— core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:139-152 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:163-176 — 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 `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:139` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1978— core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1978-1991 | core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1993-2006 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1976` calls `of`, `isMysqlDbType` and `core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1991` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:208— core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:208-221 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:250-263 — 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:107— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:107-120 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLPropertyExpr.java:109-122 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLPropertyExpr.java:124` calls `hashCode64` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:121` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:931— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:931-944 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1140-1153 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:931` 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) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:314— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:314-327 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2749-2762 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 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 `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:314` 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) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:170— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:170-183 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:762-775 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.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.
Duplicated block (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:80— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:80-93 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:493-506 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:73— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:73-86 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:91-104 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:73` 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 `x` to `DmSelectQueryBlock` in one and `OscarSelectQueryBlock` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:381— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:381-394 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1249-1262 — 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, `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:396` calls `printOnConflict`, `printReturning` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1264` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:346— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:346-359 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:289-302 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:346` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:97— core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:97-110 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3799-3812 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:97` 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 `x` to `ImpalaInsertStatement` in one and `SQLInsertStatement` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:111` calls `printHint` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3813` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1046— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1046-1059 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1288-1301 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1060` calls `token` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1302` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:523— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:523-536 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:176-189 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:175` calls `mark` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:522` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9409— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9409-9422 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:531-544 — 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:611— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:611-624 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6290-6303 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:611` 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: the declarations holding them bind `x` to `MySqlTableIndex` in one and `SQLCreateIndexStatement` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2574— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2574-2587 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11409-11422 — 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 `x` to `MySqlShowGrantsStatement` in one and `SQLShowGrantsStatement` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3611— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3611-3624 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarPermissionOutputVisitor.java:66-79 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:185— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:185-198 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:814-827 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:185` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1188— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1188-1201 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1225-1238 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1188` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:967— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:967-980 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2432-2445 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:967` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2754— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2754-2767 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4778-4791 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2754` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:348— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:348-361 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1187-1200 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:348` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarSelectQueryBlock.java:45— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarSelectQueryBlock.java:45-58 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGSelectQueryBlock.java:64-77 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarSelectQueryBlock.java:45` 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 `visitor` to `OscarASTVisitor` in one and `PGASTVisitor` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarSelectQueryBlock.java:44` calls `acceptChild` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGSelectQueryBlock.java:63` 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 (14 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1226— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1226-1239 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3638-3651 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1226` 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:213— core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:213-219 | core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:259-267 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:259` 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.
Duplicated block (7 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:159— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:159-165 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:758-764 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.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. 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) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:101— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:101-107 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:129-135 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:71— core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:71-77 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4203-4209 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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 `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:71` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:852— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:852-858 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9324-9330 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:852` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4972— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4972-4978 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:425-431 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4972` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6118— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6118-6124 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3268-3274 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6118` 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) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:575— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:575-582 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6398-6404 — 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 `x` to `OdpsReadStatement` in one and `SQLColumnReference` 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) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:372— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:372-378 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:428-434 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:372` 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:172— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:172-178 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.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.
Duplicated block (7 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4172— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4172-4178 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4221-4227 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4172` 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5587— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5587-5593 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5606-5612 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:235— core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:235-241 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1622-1628 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:235` 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, `core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1629` calls `identifierEquals` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:242` 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitorBinaryOpSupport.java:218— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitorBinaryOpSupport.java:218-224 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitorBinaryOpSupport.java:239-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 (7 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:481— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:481-487 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2046-2052 — 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatValue.java:700— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatValue.java:700-706 | core/src/main/java/com/alibaba/druid/support/http/stat/WebSessionStatValue.java:240-246 — 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 (7 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAtTimeZoneExpr.java:22— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAtTimeZoneExpr.java:22-28 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleDatetimeExpr.java:39-45 — 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 `visitor` to `SQLASTVisitor` in one and `OracleASTVisitor` 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLRevokeStatement.java:32— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLRevokeStatement.java:32-38 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsGrantStmt.java:48-54 — 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 `visitor` to `SQLASTVisitor` in one and `OdpsASTVisitor` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsGrantStmt.java:44` calls `accept0` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLRevokeStatement.java:31` 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:271— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:271-277 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/visitor/PrestoOutputVisitor.java:215-221 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLAtTimeZoneExpr` in one and `PrestoDateTimeExpr` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveSchemaStatVisitor.java:73— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveSchemaStatVisitor.java:73-79 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlSchemaStatVisitor.java:46-53 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `HiveMultiInsertStatement` in one and `SQLSelectStatement` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectJoin.java:40— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectJoin.java:40-46 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectTableReference.java:70-76 — 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 (7 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java:50— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java:50-56 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGFunctionTableSource.java:50-56 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGFunctionTableSource.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 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 `visitor` to `OscarASTVisitor` in one and `PGASTVisitor` 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/stmt/SQLServerInsertStatement.java:91— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/stmt/SQLServerInsertStatement.java:91-97 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/stmt/SQLServerUpdateStatement.java:38-44 — 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 (7 lines × 2) core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:151— core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:151-157 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java:151-157 — `core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 136 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:288— core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:288-294 | core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:287-293 — `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:156— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:156-171 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2283-2298 — 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 (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:457— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:457-472 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10691-10706 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:457` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:398— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:398-413 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:333-348 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.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.
Duplicated block (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:366— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:366-381 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8485-8500 — 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 (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:113— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:113-128 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:49-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.
Duplicated block (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:225— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:225-240 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:279-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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:225` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8225— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8225-8240 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8308-8323 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8393— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8393-8408 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:70-85 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8393` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:370— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:370-385 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8827-8842 — 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 `x` to `SQLColumnDefinition` in one and `SQLCreateSequenceStatement` 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 (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1690— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1690-1705 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3422-3437 — 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 `x` to `MySqlShowStatusStatement` in one and `SQLShowVariantsStatement` 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 (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1797— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1797-1812 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:1045-1060 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1797` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleSchemaStatVisitor.java:119— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleSchemaStatVisitor.java:119-134 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:2035-2050 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleSchemaStatVisitor.java:119` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:2052` calls `incrementDropCount` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleSchemaStatVisitor.java:135` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java:60— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java:60-75 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGFunctionTableSource.java:60-75 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGFunctionTableSource.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java:60` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:237— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:237-252 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:424-439 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 294 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:237` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:183— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:183-198 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:163-178 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:183` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `OscarSelectQueryBlock` in one and `PGSelectQueryBlock` 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 (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:554— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:554-569 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:514-529 — 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 (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:231— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:231-246 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:286-301 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:231` 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) core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkStatementParser.java:71— core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkStatementParser.java:71-86 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkStatementParser.java:100-115 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5516— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5516-5531 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5539-5554 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6181— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6181-6196 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6793-6808 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6181` 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, `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6791` calls `getNumber` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6180` 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatManager.java:138— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatManager.java:138-153 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStatManager.java:52-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. 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) core/src/main/java/com/alibaba/druid/support/opds/udf/ExportConditionColumns.java:46— core/src/main/java/com/alibaba/druid/support/opds/udf/ExportConditionColumns.java:46-61 | core/src/main/java/com/alibaba/druid/support/opds/udf/ExportSelectListColumns.java:45-60 — 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 `core/src/main/java/com/alibaba/druid/support/opds/udf/ExportConditionColumns.java:46` 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) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1235— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1235-1250 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1252-1267 — 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 `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1235` 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 (16 lines × 2) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1743— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1743-1758 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1760-1775 — 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 `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1743` 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 (16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGEndTransactionStatement.java:28— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGEndTransactionStatement.java:28-43 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGStartTransactionStatement.java:24-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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1673— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1673-1687 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1710-1724 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1673` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:431— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:431-445 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:475-489 — 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403-417 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7729-7743 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:370— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:370-384 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:264-278 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:370` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:285— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:285-299 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:817-831 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:285` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3818— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3818-3832 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3845-3859 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3835` calls `setFull` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3861` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5847— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5847-5861 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5874-5888 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5847` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1576— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1576-1590 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9239-9253 — 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 `x` to `SQLRollbackStatement` in one and `SQLCommitStatement` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1808— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1808-1822 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1872-1886 — 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 `x` to `DrdsRecoverDDLJob` in one and `DrdsClearDDLJobCache` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1497— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1497-1511 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1969-1983 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1497` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:460— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:460-474 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:477-491 — 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. 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 `x` to `SQLOrderBy` in one and `SQLZOrderBy` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1145— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1145-1159 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2201-2215 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:400— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:400-414 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1177-1191 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.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.
Duplicated block (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:281— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:281-295 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:105-119 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 75 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:281` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:377— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:377-391 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1628-1642 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 64 separate duplicated blocks between them, totalling at least 1084 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:377` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:274— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:274-288 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:308-322 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 217 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:274` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:462— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:462-476 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:741-755 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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: the declarations holding them bind `x` to `OscarCreateSchemaStatement` in one and `PGCreateSchemaStatement` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:509— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:509-523 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:282-296 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:509` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1203— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1203-1217 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1581-1595 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1203` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3254— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3254-3268 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3360-3374 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3254` 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6942— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6942-6956 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7056-7070 — 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9419— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9419-9433 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10529-10543 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9419` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3202— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3202-3216 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3219-3233 — 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. 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 `x` to `SQLExportTableStatement` in one and `SQLImportTableStatement` 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 (15 lines × 2) core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:108— core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:108-122 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java:108-122 — `core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 136 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:74— druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:74-88 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:118-132 — 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 `druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:74` 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· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×22
Members sharing a duplicated core (4 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:930— core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:930-940 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:944-954 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:958-968 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:973-983 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:180— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:180-212 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:235-267 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:280-312 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsNewExpr.java:34-61 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/blink/parser/BlinkCreateTableParser.java:38— core/src/main/java/com/alibaba/druid/sql/dialect/blink/parser/BlinkCreateTableParser.java:38-138 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:91-564 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:39-479 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4651-4722 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:100— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:100-180 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:535-742 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:994-1083 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:152-232 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:183— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:183-235 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:535-742 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:234-406 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:422-608 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:145— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:145-177 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:205-242 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:209-246 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2246-2375 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:75— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:75-123 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:45-199 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:97-224 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:99-231 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:61— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:61-115 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:161-226 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1103-1265 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1451-1538 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:604— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:604-690 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5328-5376 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5401-5444 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5446-5488 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1046— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1046-1690 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1925-1962 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2497-4005 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4057-4108 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:305— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:305-497 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:464-902 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2308-2492 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:671-857 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1880— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1880-1915 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2373-2408 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12179-12207 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12210-12246 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:567— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:567-597 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:740-761 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:771-799 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:810-829 — 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) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:374— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:374-412 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:414-452 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:454-494 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:613-633 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2860— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2860-2883 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2910-2933 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2935-2958 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2960-2983 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1171— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1171-1191 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1193-1213 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1241-1261 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1263-1300 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8599— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8599-8625 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8628-8647 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8650-8669 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8672-8708 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:245— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:245-351 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1378-1523 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1529-1667 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1747-1828 — 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) REDACTED:305— REDACTED:305-370 | core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:205-233 | REDACTED:285-351 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java:205-233 — 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:45— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:45-58 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:61-74 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStatUtils.java:29-42 | core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:195-208 — 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) core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:422— core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:422-450 | core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:840-864 | core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:921-946 | core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:973-1000 — 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) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1782— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1782-1819 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1821-1862 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1948-1999 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2138-2155 — 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· Edited copy of a member (7 corresponding lines) · ×22
Edited copy of a member (7 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:169— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:169-175 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:234-241 — 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) druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:315— druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:315-321 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:323-329 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLArchiveTableStatement.java:34— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLArchiveTableStatement.java:34-43 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLBuildTableStatement.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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2390— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2390-2396 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2883-2892 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterFunctionStatement.java:100— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterFunctionStatement.java:100-107 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateExternalCatalogStatement.java:72-78 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterServerStatement.java:51— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterServerStatement.java:51-57 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCreateDatabaseDbLinkStatement.java:103-111 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlExportParameterVisitor.java:105— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlExportParameterVisitor.java:105-112 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleExportParameterVisitor.java:96-102 — 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) core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:133— core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:133-140 | core/src/main/java/com/alibaba/druid/wall/spi/SQLServerWallVisitor.java:107-113 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddPartition.java:74— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddPartition.java:74-81 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableExchangePartition.java:35-41 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropSubpartition.java:33— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropSubpartition.java:33-39 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableSubpartitionLifecycle.java:33-39 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCloneTableStatement.java:108— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCloneTableStatement.java:108-114 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSyncMetaStatement.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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExceptionStatement.java:59— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExceptionStatement.java:59-65 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleMultiInsertStatement.java:144-150 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLFetchStatement.java:31— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLFetchStatement.java:31-37 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLOpenStatement.java:59-66 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLPurgeLogsStatement.java:39— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLPurgeLogsStatement.java:39-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLRollbackStatement.java:44-51 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowTablesStatement.java:78— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowTablesStatement.java:78-84 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/ast/SQLiteAttachStatement.java:47-53 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableAlterFullTextIndex.java:31— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableAlterFullTextIndex.java:31-37 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/ast/StarRocksIndexDefinition.java:62-69 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlExecuteStatement.java:42— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlExecuteStatement.java:42-48 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/ast/statement/StarRocksCreateTableStatement.java:49-56 — 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) core/src/main/java/com/alibaba/druid/proxy/jdbc/ConnectionProxyImpl.java:518— core/src/main/java/com/alibaba/druid/proxy/jdbc/ConnectionProxyImpl.java:518-524 | core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:1597-1603 — 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) core/src/main/java/com/alibaba/druid/pool/DruidPooledCallableStatement.java:491— core/src/main/java/com/alibaba/druid/pool/DruidPooledCallableStatement.java:491-497 | core/src/main/java/com/alibaba/druid/pool/DruidPooledPreparedStatement.java:790-798 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectItem.java:152— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectItem.java:152-159 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLTableAliasCollectVisitor.java:106-112 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:338— core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:338-344 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:479-485 — 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:292— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:292-300 | core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:746-752 — 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.
Duplicated block (9 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:498— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:498-506 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7991-7999 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12476-12485 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:498` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12470` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:494` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKSelectParser.java:158— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKSelectParser.java:158-166 | core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:203-211 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1051-1059 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKSelectParser.java: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, `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKSelectParser.java:167` calls `identifierEquals`, `nextToken`, `setWithTotals` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1060` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:235— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:235-243 | core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java:116-124 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:660-668 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 94 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.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 (9 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:28— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:28-36 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1113-1121 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:26-34 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:28` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:314— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:314-322 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:431-439 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7183-7191 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 247 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:314` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:342— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:342-350 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3893-3901 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:458-466 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:342` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1097— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1097-1105 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1297-1305 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1330-1338 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1097` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3536— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3536-3544 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3691-3699 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3708-3716 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLAlterTableAddColumn` in one and `MySqlAlterTableChangeColumn` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3546` calls `getColumns`, `size` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3701` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2760— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2760-2768 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4784-4792 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7427-7435 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2760` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:387— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:387-395 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1259-1267 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1638-1646 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:397` calls `isParenthesized` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1648` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:713— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:713-721 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2110-2118 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2603-2611 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (9 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1053— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1053-1061 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1175-1183 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1555-1563 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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: the declarations holding them bind `x` to `ConditionalInsertClauseItem` in one and `OracleMultiInsertStatement.ConditionalInsertClauseItem` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2819— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2819-2827 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarPermissionOutputVisitor.java:59-67 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3172-3180 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2819` 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6424— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6424-6432 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6442-6450 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6459-6467 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6424` 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 × 3) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2424— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2424-2432 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4243-4251 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3119-3127 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2424` 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:34— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:34-42 | core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:136-144 | core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:152-160 — 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 `core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:34` 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 × 3) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:426— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:426-434 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:512-520 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:567-575 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLSelectQueryBlock` in one and `SQLUpdateStatement` 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) core/src/main/java/com/alibaba/druid/sql/dialect/synapse/parser/SynapseExprParser.java:9— core/src/main/java/com/alibaba/druid/sql/dialect/synapse/parser/SynapseExprParser.java:9-17 | core/src/main/java/com/alibaba/druid/sql/dialect/synapse/parser/SynapseSelectParser.java:9-27 | core/src/main/java/com/alibaba/druid/sql/dialect/synapse/parser/SynapseStatementParser.java:11-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 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.
Duplicated block (9 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionByHash.java:42— core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionByHash.java:42-50 | core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionByList.java:23-31 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlPartitionByKey.java:37-45 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `visitor` to `SQLASTVisitor` in one and `MySqlASTVisitor` 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:243— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:243-251 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1486-1494 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:311-319 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 65 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 (9 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectJoin.java:114— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectJoin.java:114-122 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectJoin.java:124-132 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectQueryBlock.java:122-130 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:222— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:222-228 | core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java:103-109 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:670-676 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 94 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 (7 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:56— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:56-62 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:73-79 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:133-139 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:56` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:69` calls `token`, `parseHints`, `getHints` and `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:54` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:198— core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:198-204 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:573-579 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:698-704 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MySqlTableIndex` in one and `MySqlKey` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:94— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:94-100 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:124-130 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:132-138 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:103` calls `parseCreateTableWithSerderPropertie` and `core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:140` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:121— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:121-128 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:57-64 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4666-4672 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.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.
Duplicated block (7 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9172— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9172-9178 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1317-1323 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:620-626 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:111— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:111-117 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1028-1034 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1122-1128 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MySqlSelectQueryBlock` in one and `MySqlDeleteStatement` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2754— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2754-2760 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4778-4784 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7409-7415 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2754` 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 × 3) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2743— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2743-2749 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2774-2780 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2798-2804 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2743` 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 × 3) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1448— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1448-1454 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1597-1603 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1800-1806 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1448` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1455` calls `getOwner` and `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1807` 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 × 3) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Insert.java:37— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Insert.java:37-43 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lpad.java:40-46 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Rpad.java:44-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 all 3 call sites, so a change lands once.
Duplicated block (7 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/SQLSubPartitionByRange.java:32— core/src/main/java/com/alibaba/druid/sql/ast/SQLSubPartitionByRange.java:32-38 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSubPartitionByKey.java:41-47 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSubPartitionByValue.java:42-48 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableRenameIndex.java:34— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableRenameIndex.java:34-40 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLRenameUserStatement.java:16-22 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlRenameTableStatement.java:68-74 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `visitor` to `SQLASTVisitor` in one and `MySqlASTVisitor` 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 × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLIfStatement.java:135— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLIfStatement.java:135-141 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLWhileStatement.java:42-48 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/clause/MySqlCaseStatement.java:97-103 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `visitor` to `SQLASTVisitor` in one and `MySqlASTVisitor` 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 × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLInsertInto.java:171— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLInsertInto.java:171-177 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java:76-82 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGInsertStatement.java:74-80 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGInsertStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 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 (7 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLPrimaryKeyImpl.java:29— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLPrimaryKeyImpl.java:29-35 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlPrimaryKey.java:27-33 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlUnique.java:25-31 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `visitor` to `SQLASTVisitor` in one and `MySqlASTVisitor` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:40— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:40-46 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:620-626 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:521-527 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 247 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 (7 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2980— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2980-2986 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10395-10401 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11871-11878 — 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 `x` to `MySqlRenameSequenceStatement` in one and `SQLAlterTableRenameIndex` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:66— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:66-72 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:814-820 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1194-1200 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (7 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:905— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:905-911 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1001-1007 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1381-1387 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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 `x` to `CellAssignment` in one and `ModelClause.CellAssignment` 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 × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableStatement.java:205— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableStatement.java:205-211 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:171-177 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/PrestoDateTimeExpr.java:14-20 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `visitor` to `SQLASTVisitor` in one and `MySqlASTVisitor` 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 × 3) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1351— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1351-1359 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2155-2162 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2215-2222 — 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 `core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1351` 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) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:619— core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:619-626 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:638-645 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:738-745 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:747` calls `toString`, `resultSetLog` and `core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:646` 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 × 3) core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexOptions.java:73— core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexOptions.java:73-80 | core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexOptions.java:116-123 | core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexOptions.java:136-143 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexOptions.java:73` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:163— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:163-170 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:259-266 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:189-196 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:163` 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) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKStatementParser.java:182— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKStatementParser.java:182-189 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7842-7849 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:575-582 — 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 (8 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:60— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:60-67 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9270-9277 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:129-136 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:60` 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: the declarations holding them bind `stmt` to `SQLCreateTableStatement` in one and `SQLCreateMaterializedViewStatement` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:907— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:907-914 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1234-1241 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:148-155 — 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 (8 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7676— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7676-7683 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1783-1790 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:1023-1030 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7676` 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) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:428— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:428-435 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1196-1203 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1233-1240 — 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 (8 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:528— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:528-535 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:580-587 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:680-687 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:528` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5267— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5267-5274 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2806-2813 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5086-5093 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5267` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:62— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:62-69 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIntervalExpr.java:85-92 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSizeExpr.java:50-57 — 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.
Duplicated block (8 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLFlashbackExpr.java:68— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLFlashbackExpr.java:68-75 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNotExpr.java:59-67 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLUnaryExpr.java:67-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 all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:509— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:509-516 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:378-385 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSourceImpl.java:138-145 — 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.
Duplicated block (8 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:226— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:226-233 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1469-1476 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:294-301 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 65 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:230— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:230-237 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:251-258 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:256-263 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` as WHOLE FILES: this scan already matched 8 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. 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java:24— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java:24-31 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenFilterStatement.java:23-30 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenizerStatement.java:24-31 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenFilterStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:763— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:763-770 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:885-892 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1265-1272 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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 `x` to `ReturnRowsClause` in one and `ModelClause.ReturnRowsClause` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:846— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:846-853 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:942-949 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1322-1329 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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 `x` to `ModelColumn` in one and `ModelClause.ModelColumn` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:914— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:914-921 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1036-1043 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1416-1423 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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.
Swallowed exception (caught, then discarded) core/src/main/java/com/alibaba/druid/DbType.java:156— `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) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:378— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:407— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:429— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:455— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:467— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:481— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/support/opds/udf/ExportColumns.java:51— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/support/logging/LogFactory.java:77— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/support/ibatis/IbatisUtils.java:108— `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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:915— `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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:963— `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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1011— `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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1366— `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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1441— `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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1511— `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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1613— `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) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:586— `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) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1579— `catch (Throwable)` 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) core/src/main/java/com/alibaba/druid/pool/DruidConnectionHolder.java:169— `catch (Throwable)` 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.
D30 · Dependency Vulnerabilities· Medium CVE · ×19
Duplicated block (10 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:134— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:134-143 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java:178-187 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInSubQueryExpr.java:137-146 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 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 × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:254— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:254-263 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1497-1506 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:322-331 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 65 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:254` 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:24— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:24-33 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:22-31 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:65-74 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:24` 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:78— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:78-87 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:96-105 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:116-125 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:78` 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 `x` to `DmSelectQueryBlock` in one and `OscarSelectQueryBlock` 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:201— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:201-210 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:226-235 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:187-196 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:185` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:199` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:339— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:339-348 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:366-375 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9241-9250 — 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCheck.java:87— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCheck.java:87-96 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleForeignKey.java:89-98 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUnique.java:86-95 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCheck.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleForeignKey.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. 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 `x` to `OracleCheck` in one and `OracleForeignKey` 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:177— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:177-186 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:823-832 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1203-1212 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:177` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:528— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:528-537 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:793-802 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1173-1182 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:539` calls `printFlashback`, `getFlashback` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:804` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2430— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2430-2439 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1358-1367 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1735-1744 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2442— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2442-2451 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1371-1380 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1748-1757 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2442` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2593— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2593-2602 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1515-1524 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1892-1901 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:127— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:127-136 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:165-174 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:895-904 — 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:425— core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:425-434 | core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:924-933 | core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:977-986 — 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 `core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:425` 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, `core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:435` calls `setLong` and `core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:935` 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:373— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:373-382 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:450-459 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:472-481 — 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 `core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:373` 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) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:454— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:454-463 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:534-543 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:588-597 — 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 `core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:454` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:29— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:29-38 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:51-60 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:62-71 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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: `FetchClause` names `com.alibaba.druid.sql.dialect.dm.ast.stmt.DmSelectQueryBlock.FetchClause` in one and `com.alibaba.druid.sql.dialect.oscar.ast.stmt.OscarSelectQueryBlock.FetchClause` 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:248— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:248-257 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:3116-3125 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/visitor/PrestoOutputVisitor.java:113-122 — 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 (10 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlPrepareStatement.java:63— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlPrepareStatement.java:63-72 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/ast/stmt/SparkCacheTableStatement.java:120-129 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/ast/stmt/SparkCreateScanStatement.java:113-122 — 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.
Duplicated block (11 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:189— core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:189-199 | core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:234-244 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:461-471 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:189` 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) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:161— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:161-171 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4576-4586 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4637-4647 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:161` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:145— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:145-155 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:221-231 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:454-464 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:145` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:50— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:50-60 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:70-80 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:69-79 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` as WHOLE FILES: this scan already matched 8 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:50` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:427— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:427-437 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2625-2635 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2760-2770 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java` and `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 187 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:427` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5810— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5810-5820 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5913-5923 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7603-7613 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5924` calls `addItem` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7615` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1090— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1090-1100 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5169-5179 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6705-6715 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1090` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLDropDatabaseStatement` in one and `SQLAlterTableAddColumn` 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 (11 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:725— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:725-735 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2122-2132 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2615-2625 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1072— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1072-1082 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1278-1288 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1655-1665 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1072` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:301— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:301-311 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:427-437 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3580-3590 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 217 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:301` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2337— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2337-2347 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2830-2840 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6834-6844 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 (11 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2349— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2349-2359 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2842-2852 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6852-6862 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 (11 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:288— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:288-298 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:376-386 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:406-416 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 (11 lines × 3) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7131— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7131-7141 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7195-7205 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7229-7239 — 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 (11 lines × 3) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:134— core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:134-144 | core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:133-143 | core/src/main/java/com/alibaba/druid/support/spring/mvc/StatHandlerInterceptor.java:114-124 — `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (11 lines × 3) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1807— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1807-1819 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1989-1999 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2145-2155 — 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 `core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1807` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1987` calls `getParent` and `core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1804` 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 × 3) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1430— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1430-1440 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1461-1471 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1490-1500 — 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. 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, `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1473` calls `SQLSomeExpr` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1441` 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 × 3) core/src/main/java/com/alibaba/druid/wall/spi/DB2WallVisitor.java:29— core/src/main/java/com/alibaba/druid/wall/spi/DB2WallVisitor.java:29-39 | core/src/main/java/com/alibaba/druid/wall/spi/OracleWallVisitor.java:54-64 | core/src/main/java/com/alibaba/druid/wall/spi/PGWallVisitor.java:41-51 — 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· Edited copy of a member (12 corresponding lines) · ×17
Edited copy of a member (12 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1070— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1070-1081 | core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java:242-255 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleInsertStatement.java:83— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleInsertStatement.java:83-94 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/stmt/SQLServerInsertStatement.java:58-69 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8903— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8903-8914 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8922-8934 — 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) core/src/main/java/com/alibaba/druid/stat/JdbcDataSourceStat.java:435— core/src/main/java/com/alibaba/druid/stat/JdbcDataSourceStat.java:435-446 | core/src/main/java/com/alibaba/druid/stat/JdbcDataSourceStat.java:448-459 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectStatement.java:98— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectStatement.java:98-109 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSubqueryTableSource.java:149-160 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:143— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:143-157 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/transform/FromSubqueryResolver.java:83-94 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCastExpr.java:80— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCastExpr.java:80-91 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInSubQueryExpr.java:96-108 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/ast/CKAlterTableUpdateStatement.java:43— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/ast/CKAlterTableUpdateStatement.java:43-54 | core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/ast/CKCreateTableStatement.java:73-87 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:367— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:367-378 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6637-6649 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseStatement.java:130— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseStatement.java:130-141 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:155-166 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:446— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:446-457 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLInsertStatement.java:64-75 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:532— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:532-543 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1894-1905 — 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatManager.java:102— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatManager.java:102-113 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStatManager.java:84-95 — 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) core/src/main/java/com/alibaba/druid/pool/ha/selector/RandomDataSourceRecoverThread.java:82— core/src/main/java/com/alibaba/druid/pool/ha/selector/RandomDataSourceRecoverThread.java:82-93 | core/src/main/java/com/alibaba/druid/pool/ha/selector/RandomDataSourceValidateThread.java:269-281 — 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) core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:150— core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:150-161 | core/src/main/java/com/alibaba/druid/proxy/jdbc/StatementProxyImpl.java:135-146 — 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) core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:182— core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:182-195 | core/src/main/java/com/alibaba/druid/proxy/jdbc/StatementProxyImpl.java:223-234 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnDefault.java:41— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnDefault.java:41-57 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLConstraintImpl.java:132-143 — 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 (13 corresponding lines) · ×16
Edited copy of a member (13 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:215— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:215-227 | core/src/main/java/com/alibaba/druid/sql/dialect/teradata/parser/TDCreateTableParser.java:62-74 — 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:354— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:354-367 | core/src/main/java/com/alibaba/druid/support/http/stat/WebSessionStat.java:239-251 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectOrderByItem.java:188— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectOrderByItem.java:188-200 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectOrderByItem.java:202-214 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2533— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2533-2546 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2686-2698 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateAddLogFileGroupStatement.java:130— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateAddLogFileGroupStatement.java:130-142 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableSpaceStatement.java:37-52 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/DB2CreateSchemaStatement.java:59— core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/DB2CreateSchemaStatement.java:59-71 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGCreateSchemaStatement.java:82-95 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/visitor/RedshiftOutputVisitor.java:144— core/src/main/java/com/alibaba/druid/sql/dialect/redshift/visitor/RedshiftOutputVisitor.java:144-156 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3676-3692 — 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:108— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:108-120 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStatUtils.java:60-72 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:79— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:79-91 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:104-120 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTriggerStatement.java:68— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTriggerStatement.java:68-84 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoPrepareStatement.java:91-103 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowColumnsStatement.java:90— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowColumnsStatement.java:90-105 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleLockTableStatement.java:93-105 — 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) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3508— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3508-3520 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:4794-4806 — 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) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3631— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3631-3643 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:4631-4643 — 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) core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:213— core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:213-225 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:227-239 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleFunctionDataType.java:57— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleFunctionDataType.java:57-72 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleProcedureDataType.java:43-55 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionByHash.java:52— core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionByHash.java:52-67 | core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionByList.java:41-53 — 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.
AC3 · Page structure· Page without a main landmark · ×15
Page without a main landmark core/src/main/resources/support/http/resources/activeConnectionStackTrace.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/api.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark REDACTED:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/datasource.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/login.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/nopermit.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/spring-detail.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/spring.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/sql-detail.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/sql.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/wall.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/webapp.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/websession-detail.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark core/src/main/resources/support/http/resources/websession.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×15
Edited copy of a member (14 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKSelectParser.java:157— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKSelectParser.java:157-173 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1050-1063 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4491— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4491-4509 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:494-507 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:226— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:226-246 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1260-1273 — 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) core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:41— core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:41-54 | core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:71-84 — 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) core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:163— core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:163-176 | core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:179-192 — 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:469— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:469-482 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStat.java:50-64 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:490— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:490-503 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1010-1023 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:900— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:900-914 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5845-5858 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:215— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:215-228 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:234-250 — 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) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:3760— core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:3760-3773 | core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:3776-3789 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2005— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2005-2018 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2021-2035 — 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) core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:127— core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:127-140 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:143-156 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2351— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2351-2364 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2366-2379 — 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) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:605— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:605-618 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:621-634 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4936— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4936-4954 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8033-8046 — 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.
Duplicated block (17 lines × 2) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3944— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3944-3960 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3986-4002 — 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. 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) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3965— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3965-3981 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:4007-4023 — 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. 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) core/src/main/java/com/alibaba/druid/pool/PreparedStatementPool.java:113— core/src/main/java/com/alibaba/druid/pool/PreparedStatementPool.java:113-129 | core/src/main/java/com/alibaba/druid/pool/PreparedStatementPool.java:144-160 — 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 (17 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:179— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:179-195 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseStatement.java:154-170 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:231— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:231-247 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:464-480 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:231` 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) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:340— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:340-356 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3764-3780 — 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 `x` to `GaussDbInsertStatement` in one and `SQLInsertStatement` 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 (17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:303— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:303-319 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:88-104 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:303` 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:233— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:233-249 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:72-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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:72` 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.
Duplicated block (17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:34— core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:34-50 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:46-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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:34` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:33` calls `setLogical` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:45` 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 (17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4943— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4943-4959 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5189-5205 — 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 `x` to `MySqlCreateEventStatement` in one and `MySqlAlterEventStatement` 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 (17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:154— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:154-170 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:226-242 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:154` 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2420— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2420-2436 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3115-3131 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2420` 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 (17 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8631— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8631-8647 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8653-8669 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8631` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLMergeStatement.WhenDoNothing` in one and `SQLMergeStatement.WhenDelete` 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 (17 lines × 2) core/src/main/java/com/alibaba/druid/util/FnvHash.java:302— core/src/main/java/com/alibaba/druid/util/FnvHash.java:302-318 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:336-352 — 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 `core/src/main/java/com/alibaba/druid/util/FnvHash.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.
Duplicated block (17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowJobStatusStatement.java:25— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowJobStatusStatement.java:25-49 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowMigrateTaskStatusStatement.java:24-40 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowJobStatusStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowMigrateTaskStatusStatement.java` as WHOLE FILES: 89% 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· Edited copy of a member (15 corresponding lines) · ×14
Edited copy of a member (15 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelect.java:396— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelect.java:396-410 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:221-236 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexOptions.java:109— core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexOptions.java:109-123 | core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexOptions.java:129-143 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4238— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4238-4254 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4257-4271 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAssignItem.java:34— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAssignItem.java:34-48 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateSetItem.java:131-145 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:450— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:450-464 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:488-502 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:402— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:402-416 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2378-2393 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMatchAgainstExpr.java:50— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMatchAgainstExpr.java:50-65 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLWithSubqueryClause.java:151-165 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSubqueryTableSource.java:92— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSubqueryTableSource.java:92-106 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectSubqueryTableSource.java:76-93 — 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) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlFormat.java:21— core/src/main/java/com/alibaba/druid/support/opds/udf/SqlFormat.java:21-35 | core/src/main/java/com/alibaba/druid/support/opds/udf/SqlSyntaxCheck.java:21-39 — 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:1233— core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:1233-1247 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:1249-1266 — 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) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:697— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:697-716 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:733-747 — 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) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:246— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:246-264 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:270-284 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:146— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:146-161 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSourceImpl.java:164-178 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5667— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5667-5681 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:2370-2386 — 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 (16 corresponding lines) · ×14
Edited copy of a member (16 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:193— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:193-209 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlTableIndex.java:138-153 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2420— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2420-2435 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2736-2755 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:166— core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:166-182 | core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:211-226 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:306— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:306-321 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:130-150 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2693— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2693-2708 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2710-2725 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3159— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3159-3174 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11904-11919 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1322— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1322-1337 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1359-1378 — 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2221— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2221-2236 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:564-581 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSetStatement.java:137— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSetStatement.java:137-152 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/clause/OracleReturningClause.java:62-78 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:159— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:159-174 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java:203-222 — 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) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:3393— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:3393-3410 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:3412-3427 — 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) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:793— core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:793-812 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:827-842 — 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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:2120— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:2120-2138 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:2140-2155 — 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) core/src/main/java/com/alibaba/druid/pool/DruidPooledPreparedStatement.java:543— core/src/main/java/com/alibaba/druid/pool/DruidPooledPreparedStatement.java:543-559 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:787-802 — 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· Edited copy of a member (8 corresponding lines) · ×14
Edited copy of a member (8 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2189— core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2189-2196 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:68-75 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectTableReference.java:78— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectTableReference.java:78-87 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSourceImpl.java:254-261 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCallStatement.java:73— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCallStatement.java:73-80 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/stmt/SQLServerExecStatement.java:55-62 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsReadStatement.java:34— core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsReadStatement.java:34-42 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsUndoTableStatement.java:40-47 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionBatch.java:35— core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionBatch.java:35-42 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/ast/GaussDbPartitionValue.java:84-93 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowBinLogEventsStatement.java:27— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowBinLogEventsStatement.java:27-34 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowRelayLogEventsStatement.java:51-58 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCreateTableStatement.java:413— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCreateTableStatement.java:413-420 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUsingIndexClause.java:47-54 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLErrorLoggingClause.java:29— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLErrorLoggingClause.java:29-36 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLMergeStatement.java:33-42 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlRaftLeaderTransferStatement.java:29— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlRaftLeaderTransferStatement.java:29-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlRaftMemberChangeStatement.java:29-36 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/visitor/SQLiteOutputVisitor.java:66— core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/visitor/SQLiteOutputVisitor.java:66-73 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:496-504 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectOrderByItem.java:169— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectOrderByItem.java:169-178 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/expr/MySqlOrderingExpr.java:39-46 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLBackupStatement.java:32— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLBackupStatement.java:32-40 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLRestoreStatement.java:31-38 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlExportParameterVisitor.java:95— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlExportParameterVisitor.java:95-102 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleExportParameterVisitor.java:86-93 — 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) druid-demo-petclinic/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java:116— druid-demo-petclinic/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java:116-124 | druid-demo-petclinic/src/main/java/org/springframework/samples/petclinic/vet/VetController.java:55-62 — 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.
Low cohesion: DruidDataSource (LCOM4 9) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:81— DruidDataSource's methods fall into 9 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 9 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: PreparedStatementProxyImpl (LCOM4 9) core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:34— PreparedStatementProxyImpl's methods fall into 9 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 9 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: ResultSetProxyImpl (LCOM4 7) core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:33— ResultSetProxyImpl's methods fall into 7 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 7 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: SQLCreateTableStatement (LCOM4 7) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:37— SQLCreateTableStatement's methods fall into 7 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 7 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: SQLCreateDatabaseStatement (LCOM4 6) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:30— SQLCreateDatabaseStatement'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: OscarInsertStatement (LCOM4 6) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java:32— OscarInsertStatement'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: PGInsertStatement (LCOM4 5) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGInsertStatement.java:30— PGInsertStatement's methods fall into 5 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 5 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: Log4j2Filter (LCOM4 4) core/src/main/java/com/alibaba/druid/filter/logging/Log4j2Filter.java:24— Log4j2Filter'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: Log4jFilter (LCOM4 4) core/src/main/java/com/alibaba/druid/filter/logging/Log4jFilter.java:24— Log4jFilter'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: SQLShowOutlinesStatement (LCOM4 4) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowOutlinesStatement.java:24— SQLShowOutlinesStatement'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: SQLObjectImpl (LCOM4 4) core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:31— SQLObjectImpl'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: CKCreateTableStatement (LCOM4 4) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/ast/CKCreateTableStatement.java:14— CKCreateTableStatement'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: GaussDbCreateTableStatement (LCOM4 4) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/ast/stmt/GaussDbCreateTableStatement.java:11— GaussDbCreateTableStatement'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: JdbcStatManager (LCOM4 4) core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:29— JdbcStatManager'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.
Duplicated block (24 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1210— core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1210-1233 | core/src/main/java/com/alibaba/druid/pool/ha/HighAvailableDataSource.java:256-279 — 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 `core/src/main/java/com/alibaba/druid/pool/ha/HighAvailableDataSource.java:256` 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 (24 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:69— core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:69-92 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1515-1538 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:69` 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 (24 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:453— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:453-476 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:747-770 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:453` 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 (24 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1223— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1223-1246 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:137-160 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1223` 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 (24 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2357— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2357-2380 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2448-2471 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2357` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:302— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:302-325 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:834-857 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 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, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:858` calls `token` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:326` 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 (24 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3997— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3997-4020 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10986-11009 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3997` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MySqlAnalyzeStatement` in one and `SQLAnalyzeTableStatement` 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 (24 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1076— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1076-1099 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6691-6714 — 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 `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 (24 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:202— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:202-225 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:182-205 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:375— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:375-398 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:415-438 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:375` 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 (24 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1500— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1500-1523 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1644-1667 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1500` 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 (24 lines × 2) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:376— core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:376-399 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:444-467 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/stat/DruidStatService.java` and `druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 108 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) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1097— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1097-1120 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1550-1573 — 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 `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1097` 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1324— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1324-1342 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1378-1396 — 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 `core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1324` 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.
Duplicated block (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:134— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:134-152 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java:178-196 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:134` 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:135— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:135-153 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:119-137 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 262 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:761— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:761-779 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:262-280 — 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:69— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:69-87 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:228-246 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:69` 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 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:264— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:264-282 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:126-144 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:264` 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:989— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:989-1007 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1027-1045 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:989` 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4171— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4171-4189 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4632-4650 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4171` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:581— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:581-599 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6931-6949 — 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 `x` to `MySqlTableIndex` in one and `SQLIndexDefinition` 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:217— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:217-235 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:466-484 — 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 `x` to `SQLSubqueryTableSource` in one and `OracleSelectSubqueryTableSource` 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 (19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1190— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1190-1208 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1310-1328 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1190` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:572— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:572-590 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:949-967 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:179— core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:179-197 | core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:178-196 — `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 × 3) core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:202— core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:202-216 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:225-239 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:248-262 — 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 `core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:202` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:230— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:230-244 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:368-382 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:365-379 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:230` 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: the declarations holding them bind `x` to `DmUpdateStatement` in one and `OscarUpdateStatement` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:165— core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:165-179 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:725-739 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11502-11516 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:165` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1177— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1177-1191 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1216-1230 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:130-144 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1177` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:291— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:291-305 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2018-2032 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2511-2525 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:291` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:480— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:480-494 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1863-1877 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2253-2267 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:480` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:821— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:821-835 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:917-931 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1297-1311 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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: the declarations holding them bind `x` to `ModelColumnClause` in one and `ModelClause.ModelColumnClause` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1093— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1093-1107 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9645-9659 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9662-9676 — 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. 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 `x` to `OracleDatetimeExpr` in one and `SQLAtTimeZoneExpr` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1642— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1642-1656 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1689-1703 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2079-2093 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1642` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:375— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:375-389 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:372-386 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:165-179 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `x` to `OscarUpdateStatement` in one and `PGUpdateStatement` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:212— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:212-226 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:334-348 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:523-537 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:212` 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 (15 lines × 3) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1550— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1550-1564 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1574-1588 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1598-1612 — 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 (15 lines × 3) druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java:38— druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java:38-52 | druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/DruidDataSourceWrapper.java:38-52 | druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceWrapper.java:38-52 — before extracting anything, compare `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java` and `druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/DruidDataSourceWrapper.java` as WHOLE FILES: 94% 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. 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 (6 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:69— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:69-74 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:271-276 | core/src/main/java/com/alibaba/druid/sql/dialect/teradata/parser/TDSelectParser.java:93-98 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:69` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:68— core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:68-74 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4200-4206 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.java:94-99 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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 `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:68` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:66` calls `accept` and `core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.java:92` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:450— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:450-455 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:460-465 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:470-475 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:450` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:371— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:371-376 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:414-419 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:427-432 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:371` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:420` calls `nextIf` and `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:377` 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 (6 lines × 3) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3876— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3876-3881 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6972-6977 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7072-7077 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3876` 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, `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7070` calls `setTableSource`, `name` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3874` 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 × 3) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:51— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:51-56 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Length.java:50-55 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ucase.java:50-55 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Length.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ucase.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 3 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 `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:51` 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 × 3) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:432— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:432-437 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:450-455 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:469-474 — 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 `core/src/main/java/com/alibaba/druid/wall/WallFilter.java:432` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1020— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1020-1025 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2836-2841 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:3127-3132 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1020` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:57— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:57-62 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:68-73 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:78-83 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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. 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:838— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:838-843 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:934-939 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1314-1319 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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 `x` to `QueryPartitionClause` in one and `ModelClause.QueryPartitionClause` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1527— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1527-1532 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1297-1302 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1674-1679 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2749— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2749-2754 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1655-1660 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2032-2037 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2378— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2378-2383 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2871-2876 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:545-550 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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. 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.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOperator.java:109— `getPriority` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:26— `executeStatements` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:30— `executeStatement` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:34— `executeIf` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:38— `executeWhile` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:42— `executeLoop` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:46— `executeCase` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:50— `executeAssign` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:54— `executeOpen` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:58— `executeFetch` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:62— `executeClose` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:66— `executeSQL` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:70— `executeFunction` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×12
Edited copy of a member (9 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBetweenExpr.java:124— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBetweenExpr.java:124-132 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInSubQueryExpr.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) core/src/main/java/com/alibaba/druid/sql/dialect/databricks/parser/DatabricksCreateTableParser.java:31— core/src/main/java/com/alibaba/druid/sql/dialect/databricks/parser/DatabricksCreateTableParser.java:31-39 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:93-101 — 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) core/src/main/java/com/alibaba/druid/wall/WallVisitor.java:182— core/src/main/java/com/alibaba/druid/wall/WallVisitor.java:182-191 | core/src/main/java/com/alibaba/druid/wall/spi/OracleWallVisitor.java:39-47 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:850— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:850-858 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/visitor/PrestoOutputVisitor.java:189-197 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnDefinition.java:305— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnDefinition.java:305-313 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/stmt/HiveCreateFunctionStatement.java:28-36 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:93— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:93-103 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseStatement.java:85-93 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLJoinTableSource.java:120— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLJoinTableSource.java:120-128 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:532-541 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterLogFileGroupStatement.java:30— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterLogFileGroupStatement.java:30-38 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTablespaceStatement.java:32-40 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:268— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:268-277 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLateralViewTableSource.java:41-49 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableChangeColumn.java:35— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableChangeColumn.java:35-44 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableModifyColumn.java:33-41 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/ast/HiveInsert.java:80— core/src/main/java/com/alibaba/druid/sql/dialect/hive/ast/HiveInsert.java:80-89 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/ast/HiveMultiInsertStatement.java:62-70 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIdentifierExpr.java:64— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIdentifierExpr.java:64-72 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLPropertyExpr.java:148-157 — 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) · ×12
Edited copy of a member (10 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:27— core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:27-38 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2582-2591 — 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) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1396— core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1396-1405 | core/src/main/java/com/alibaba/druid/proxy/jdbc/DataSourceProxyImpl.java:131-140 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8836— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8836-8845 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8850-8863 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectJoin.java:48— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectJoin.java:48-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectSubqueryTableSource.java:46-55 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExprGroup.java:69— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExprGroup.java:69-78 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectGroupByClause.java:42-57 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLArrayExpr.java:151— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLArrayExpr.java:151-163 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLValuesExpr.java:59-68 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:371— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:371-380 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:920-930 — 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) core/src/main/java/com/alibaba/druid/wall/WallVisitor.java:240— core/src/main/java/com/alibaba/druid/wall/WallVisitor.java:240-250 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:116-125 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateFunctionStatement.java:97— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateFunctionStatement.java:97-106 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateProcedureStatement.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.
Edited copy of a member (10 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGCopyStatement.java:106— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGCopyStatement.java:106-116 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCopyFromStatement.java:21-30 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:81— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:81-90 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerExprParser.java:77-86 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:270— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:270-279 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3820-3829 — 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.
Duplicated block (20 lines × 2) core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:41— core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:41-65 | core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java:49-68 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java` and `core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 77 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 `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:41` 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, `core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java:46` calls `abs`, `getErrorCode` and `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:37` 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:325— core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:325-344 | core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:373-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 `core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:325` 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddIndex.java:38— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddIndex.java:38-57 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAlterIndex.java:38-57 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddIndex.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAlterIndex.java` as WHOLE FILES: 97% 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. 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:85— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:85-104 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:789-808 — 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:216— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:216-235 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2691-2710 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:216` 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1349— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1349-1368 | core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftExprParser.java:114-133 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1349` 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1850— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1850-1869 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2240-2259 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:781— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:781-800 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:963-982 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:781` 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3876— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3876-3895 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6972-6991 — 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/support/ibatis/SpringIbatisBeanNameAutoProxyCreator.java:45— core/src/main/java/com/alibaba/druid/support/ibatis/SpringIbatisBeanNameAutoProxyCreator.java:45-64 | core/src/main/java/com/alibaba/druid/support/ibatis/SpringIbatisBeanTypeAutoProxyCreator.java:67-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. 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/util/StringUtils.java:214— core/src/main/java/com/alibaba/druid/util/StringUtils.java:214-233 | core/src/main/java/com/alibaba/druid/util/StringUtils.java:312-331 — 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 (20 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:550— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:550-569 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1076-1095 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:550` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1096` calls `token` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:570` 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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1471— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1471-1488 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1565-1582 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1471` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLAggregateExpr` in one and `SQLMethodInvokeExpr` 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 (18 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/SQLPivot.java:60— core/src/main/java/com/alibaba/druid/sql/ast/SQLPivot.java:60-77 | core/src/main/java/com/alibaba/druid/sql/ast/SQLUnpivot.java:59-76 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/SQLPivot.java:60` 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 (18 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterSequenceStatement.java:54— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterSequenceStatement.java:54-71 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateSequenceStatement.java:73-90 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterSequenceStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateSequenceStatement.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 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) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:331— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:331-348 | core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java:41-58 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:365— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:365-382 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:304-321 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:365` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:896— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:896-913 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1276-1293 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4151— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4151-4168 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4202-4219 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4151` 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1574— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1574-1591 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1842-1859 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1574` 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5551— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5551-5568 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5638-5655 — 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 `x` to `SQLAlterViewStatement` in one and `SQLCreateViewStatement` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5657` calls `printCreateViewAs`, `isWithCheckOption` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5570` 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) REDACTED:447— REDACTED:447-464 | REDACTED:474-491 — 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:447` 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 first that the copies are not typed on the same thing: the declarations holding them bind `hash` to `int` in one and `long` 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 (18 lines × 2) druid-wrapper/src/main/java/org/apache/commons/dbcp/BasicDataSourceFactory.java:1— druid-wrapper/src/main/java/org/apache/commons/dbcp/BasicDataSourceFactory.java:1-20 | druid-wrapper/src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java:1-18 — 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 `druid-wrapper/src/main/java/org/apache/commons/dbcp/BasicDataSourceFactory.java:1` 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 (18 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowDatabasesStatement.java:95— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowDatabasesStatement.java:95-112 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowTablesStatement.java:87-104 — 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 (13 lines × 3) core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:70— core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:70-82 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:94-106 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:116-128 — 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 `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.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.
Duplicated block (13 lines × 3) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:37— core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:37-49 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:54-66 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:72-84 — 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 (13 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:201— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:201-213 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:226-238 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:231-243 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` as WHOLE FILES: this scan already matched 8 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:201` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:200` calls `setParent` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:225` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java:51— core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java:51-63 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:226-238 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java:208-220 — 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 (13 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3544— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3544-3556 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:972-984 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:404-416 — 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 (13 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1602— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1602-1614 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7179-7191 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10247-10259 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLShowTablesStatement` in one and `SQLShowColumnsStatement` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7193` calls `isExtended`, `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1616` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1475— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1475-1487 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2228-2240 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2721-2733 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1475` 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 (13 lines × 3) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:329— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:329-341 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1487-1499 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1626-1638 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLIdentifierExpr` in one and `SQLPropertyExpr` 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 (13 lines × 3) core/src/main/java/com/alibaba/druid/util/FnvHash.java:139— core/src/main/java/com/alibaba/druid/util/FnvHash.java:139-151 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:155-167 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:171-183 — 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 `core/src/main/java/com/alibaba/druid/util/FnvHash.java:139` 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 first that the copies are not typed on the same thing: the declarations holding them bind `key` to `String` in one and `StringBuilder` 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 (13 lines × 3) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:639— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:639-651 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:656-668 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:682-694 — 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. 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 × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:62— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:62-74 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:491-503 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java:78-90 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 61 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 (13 lines × 3) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserFeature.java:79— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserFeature.java:79-91 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitor.java:50-62 | core/src/main/java/com/alibaba/druid/sql/visitor/VisitorFeature.java:66-78 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `features` to `SQLParserFeature...` in one and `VisitorFeature...` 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 (5 lines × 2) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:469— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:469-473 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11967-11971 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:469` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:83— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:83-87 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:129-133 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:83` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:122— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:122-126 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:127-131 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:122` 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 × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:128— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:128-132 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:133-137 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 (5 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:138— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:138-142 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:143-147 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:138` 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 × 2) core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:192— core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:192-196 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:6501-6505 — 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) core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStatValue.java:370— core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStatValue.java:370-374 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringMethodStatValue.java:324-328 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateMaterializedViewStatement.java:425— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateMaterializedViewStatement.java:425-429 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1567-1571 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateMaterializedViewStatement.java:431` calls `getTableOptions` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1573` 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 (5 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1186— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1186-1190 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1272-1276 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1186` 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:383— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:383-387 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:399-403 — 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 (5 lines × 2) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:286— core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:286-290 | core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:292-296 — 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) core/src/main/java/com/alibaba/druid/stat/JdbcDataSourceStat.java:258— core/src/main/java/com/alibaba/druid/stat/JdbcDataSourceStat.java:258-262 | core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:280-284 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/stat/JdbcDataSourceStat.java:257` calls `getSqlStatMap` and `core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:279` 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· Edited copy of a member (19 corresponding lines) · ×11
Edited copy of a member (19 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:265— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:265-283 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:347-365 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:293— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:293-311 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:419-437 — 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) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2154— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2154-2172 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2214-2232 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:328— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:328-346 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:555-580 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:124— core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:124-149 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:202-220 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:533— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:533-553 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1485-1503 — 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) core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:674— core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:674-692 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:812-830 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLBlockStatement.java:127— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLBlockStatement.java:127-149 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLIfStatement.java:30-48 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3425— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3425-3443 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3653-3672 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:358— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:358-376 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:463-487 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLGroupingSetExpr.java:102— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLGroupingSetExpr.java:102-120 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLVariantRefExpr.java:123-142 — 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 (11 corresponding lines) · ×11
Edited copy of a member (11 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:328— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:328-338 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2409-2422 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4298— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4298-4308 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4311-4324 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2996— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2996-3008 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3079-3089 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionSingle.java:96— core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionSingle.java:96-106 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OraclePartitionSingle.java:212-224 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUpdateStatement.java:63— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUpdateStatement.java:63-73 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/stmt/SQLServerUpdateStatement.java:67-77 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCastExpr.java:130— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCastExpr.java:130-140 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGTypeCastExpr.java:53-63 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaStatementParser.java:47— core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaStatementParser.java:47-57 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1505-1515 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:394— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:394-404 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:884-895 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionValue.java:69— core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionValue.java:69-79 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExprGroup.java:81-91 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLDeclareItem.java:51— core/src/main/java/com/alibaba/druid/sql/ast/SQLDeclareItem.java:51-63 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowCreateTableStatement.java:66-76 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:198— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:198-208 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropTableSpaceStatement.java:56-66 — 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.
Duplicated block (28 lines × 2) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1643— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1643-1670 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1680-1707 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1643` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `OdpsSelectQueryBlock` in one and `SQLCreateTableStatement` 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:122— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:122-149 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1542-1569 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:122` 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1368— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1368-1395 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1717-1744 — 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 `x` to `MySqlLoadDataInFileStatement` in one and `MySqlLoadXmlStatement` 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:74— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:74-101 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:73-100 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 217 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:570— core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:570-597 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:630-657 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:570` 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9327— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9327-9354 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9474-9501 — 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 `x` to `SQLAlterMaterializedViewStatement` in one and `SQLCreateMaterializedViewStatement` 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:138— core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:138-165 | core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java:137-164 — `core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 117 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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: `Cookie` names `jakarta.servlet.http.Cookie` in one and `javax.servlet.http.Cookie` 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 (28 lines × 2) REDACTED:193— REDACTED:193-220 | REDACTED:180-207 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 238 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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: `HttpServletResponse` names `jakarta.servlet.http.HttpServletResponse` in one and `javax.servlet.http.HttpServletResponse` 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:72— core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:72-99 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java:72-99 — `core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 136 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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: `ServletException` names `jakarta.servlet.ServletException` in one and `javax.servlet.ServletException` 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:206— core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:206-233 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java:206-233 — `core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 136 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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: `HttpServletRequest` names `jakarta.servlet.http.HttpServletRequest` in one and `javax.servlet.http.HttpServletRequest` 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 (28 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/ast/SQLiteDetachStatement.java:12— core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/ast/SQLiteDetachStatement.java:12-39 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/ast/SQLiteVacuumStatement.java:12-39 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/ast/SQLiteDetachStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/ast/SQLiteVacuumStatement.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.
Change coupling: SQLServerSelectParser.java ↔ SQLServerOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:1— `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java` change together 67% of the time (12 of the 18 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 12 shared commits counted here, the most recent 3 are `354302f7` Unified top sqlnode, parser and outputvisitor.; `38979d91` Support 'option' on sqlserver select statement.; `a288d101` bug fixed for sql server parser. for issue #1795 (at that commit the files were still `src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java` and `src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java`) — run `git show` on any of them.
Change coupling: BigQueryStatementParser.java ↔ BigQueryOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:1— `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` change together 67% of the time (8 of the 12 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 8 shared commits counted here, the most recent 3 are `08cc4abb` feat: enhance BigQuery dialect with EXPORT DATA, CREATE SCHEMA/PROCED…; `4087fa9a` bigquery sql parser support create model; `54875e5c` bigquery sql parser support execute immediate — run `git show` on any of them.
Change coupling: StarRocksCreateTableParser.java ↔ StarRocksOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java:1— `core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java` change together 65% of the time (11 of the 17 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 `8b76e1d2` Support parse bucket auto. (#6407); `992bc0cf` 支持 Doris AUTO PARTITION 语法,及 pg crate/alter/drop schema 语句中同时指定库,db2 …; `33eb0517` Fix sr index parser. — run `git show` on any of them.
Change coupling: CKCreateTableParser.java ↔ CKOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKCreateTableParser.java:1— `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java` change together 64% of the time (7 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) 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 7 shared commits counted here, the most recent 3 are `78fa7415` feat: Add ClickHouse ON CLUSTER support for CREATE/DROP TABLE statements; `2a44a334` Fix ck create table comment.; `0dbf76df` Refactor clickhouse partition by. — run `git show` on any of them.
Change coupling: OracleCreateTableParser.java ↔ OracleOutputVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:1— `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` change together 60% of the time (9 of the 15 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 9 shared commits counted here, the most recent 3 are `b77a7511` refactor & improve bigquery support; `ade87e4b` improved hive sql parser support. (at that commit the files were still `src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java` and `src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java`); `888cdc34` improved sql parser for OracleCreateIndex. issue #1923 (at that commit the files were still `src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java` and `src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java`) — run `git show` on any of them.
Change coupling: PGSQLStatementParser.java ↔ PGASTVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1— `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitor.java` change together 58% of the time (18 of the 31 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 18 shared commits counted here, the most recent 3 are `3fb4d2d2` improve dialect support for PostgreSQL, SQL Server, and ClickHouse (#…; `d5c89363` 支持 PG DDL 语句若干,MySQL 支持 create/alter database ... collate 语句 (#6276); `0bc082ce` 增加pg的do语法解析的支持 #3468 — run `git show` on any of them.
Change coupling: ExportParameterVisitorUtils.java ↔ ParameterizedOutputVisitorUtils.java core/src/main/java/com/alibaba/druid/sql/visitor/ExportParameterVisitorUtils.java:1— `core/src/main/java/com/alibaba/druid/sql/visitor/ExportParameterVisitorUtils.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java` change together 56% of the time (10 of the 18 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 `66499290` Support PolarDB-X.; `56b82fb8` 添加对Lealone数据库的支持; `8163f00a` 重新提交PR针对Postgresql 加上 analyze和vacuum的sql 解析#5412 (#5439) — run `git show` on any of them.
Change coupling: PGSQLStatementParser.java ↔ PGASTVisitorAdapter.java core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1— `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitorAdapter.java` change together 50% of the time (12 of the 24 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 12 shared commits counted here, the most recent 3 are `9e2f59ae` 增加postgresql的End语法支持 #3538; `8343ca08` refactor sql parser. (at that commit the files were still `src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` and `src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitorAdapter.java`); `b531cb8c` 添加postgresql的begin,commit,set命令解析 (at that commit the files were still `src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` and `src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitorAdapter.java`) — run `git show` on any of them.
Change coupling: SQLBinaryOperator.java ↔ Token.java core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOperator.java:1— `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOperator.java` and `core/src/main/java/com/alibaba/druid/sql/parser/Token.java` change together 50% of the time (11 of the 22 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 `1026c18f` support double question mark and vertical bar token parser; `22353f3a` improved sql parser. (at that commit the files were still `src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOperator.java` and `src/main/java/com/alibaba/druid/sql/parser/Token.java`); `814cb1f0` improved postgresql parser. for issue #1841 (at that commit the files were still `src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOperator.java` and `src/main/java/com/alibaba/druid/sql/parser/Token.java`) — run `git show` on any of them.
Change coupling: BigQueryStatementParser.java ↔ BigQueryVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:1— `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java` change together 50% of the time (5 of the 10 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 5 shared commits counted here, the most recent 3 are `08cc4abb` feat: enhance BigQuery dialect with EXPORT DATA, CREATE SCHEMA/PROCED…; `4087fa9a` bigquery sql parser support create model; `54875e5c` bigquery sql parser support execute immediate — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×10
Edited copy of a member (25 corresponding lines) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:588— core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:588-612 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:790-818 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:395— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:395-423 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7723-7747 — 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) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1209— core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1209-1233 | core/src/main/java/com/alibaba/druid/pool/ha/HighAvailableDataSource.java:251-279 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:275— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:275-299 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:807-831 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLPivot.java:53— core/src/main/java/com/alibaba/druid/sql/ast/SQLPivot.java:53-77 | core/src/main/java/com/alibaba/druid/sql/ast/SQLUnpivot.java:52-76 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1689— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1689-1713 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3421-3445 — 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) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1350— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1350-1374 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1404-1428 — 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) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1323— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1323-1347 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1377-1401 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7817— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7817-7841 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7843-7867 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:367— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:367-391 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:400-429 — 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.
Duplicated block (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5497— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5497-5528 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5537-5568 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5497` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5496` calls `SQLAlterProcedureStatement` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5536` 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:229— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:229-260 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:209-240 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `x` to `OscarDeleteStatement` in one and `PGDeleteStatement` 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:593— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:593-624 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:970-1001 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/util/StringUtils.java:179— core/src/main/java/com/alibaba/druid/util/StringUtils.java:179-210 | core/src/main/java/com/alibaba/druid/util/StringUtils.java:278-309 — 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 `core/src/main/java/com/alibaba/druid/util/StringUtils.java:179` 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:76— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:76-107 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:314-345 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:76` 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1440— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1440-1471 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1589-1620 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1440` 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: the declarations holding them bind `x` to `SQLPropertyExpr` in one and `SQLIdentifierExpr` 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:160— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:160-191 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlTableIndex.java:105-136 — 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowStatisticListStmt.java:30— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowStatisticListStmt.java:30-61 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowStatisticStmt.java:34-80 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowStatisticListStmt.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowStatisticStmt.java` as WHOLE FILES: 86% 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. 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLGetDiagnosticsStatement.java:11— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLGetDiagnosticsStatement.java:11-42 | core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/DB2ValuesStatement.java:1-42 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/DB2ValuesStatement.java:1` 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 (32 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowHtcStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowHtcStatement.java:1-32 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowStcStatement.java:1-32 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowHtcStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowStcStatement.java` as WHOLE FILES: 95% 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. 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowHtcStatement.java:1` 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 (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:94— core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:94-115 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4818-4839 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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. 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:506— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:506-527 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:540-561 — 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 (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:254— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:254-275 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:78-99 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 75 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:254` 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 (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:319— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:319-340 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:139-160 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 75 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 (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2148— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2148-2169 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:826-847 — 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 (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1570— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1570-1591 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2010-2031 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1570` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2033` calls `identifierEquals` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1593` 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 (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4370— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4370-4391 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7612-7633 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4370` 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 (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7026— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7026-7047 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7104-7125 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7026` 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 (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCheckTableStatement.java:12— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCheckTableStatement.java:12-33 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlChecksumTableStatement.java:15-52 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCheckTableStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlChecksumTableStatement.java` as WHOLE FILES: 84% 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.
Duplicated block (22 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleGotoStatement.java:24— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleGotoStatement.java:24-45 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleLabelStatement.java:24-45 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleGotoStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleLabelStatement.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.
Duplicated block (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAliasedExpr.java:85— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAliasedExpr.java:85-105 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSourceImpl.java:57-77 — 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 (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2248— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2248-2268 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:862-882 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2248` 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:100— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:100-120 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:120-140 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `x` to `OscarSelectQueryBlock` in one and `PGSelectQueryBlock` 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 (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4455— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4455-4475 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7669-7689 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4455` 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 (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:548— core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:548-568 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:608-628 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:548` 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 (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:908— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:908-928 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:987-1007 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:908` 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 (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11226— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11226-11246 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11252-11272 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11226` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLShowQueryTaskStatement` in one and `SQLShowOutlinesStatement` 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 (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1092— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1092-1112 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1292-1312 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1092` 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 (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableCoalescePartition.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableCoalescePartition.java:1-42 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTablePartitionCount.java:25-45 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableCoalescePartition.java:1` 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 (21 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTablePartitionLifecycle.java:25— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTablePartitionLifecycle.java:25-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableSetLifecycle.java:1-42 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableSetLifecycle.java:1` 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:341— core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:341-354 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:364-377 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:387-400 — 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 `core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:341` 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/blink/parser/BlinkCreateTableParser.java:44— core/src/main/java/com/alibaba/druid/sql/dialect/blink/parser/BlinkCreateTableParser.java:44-57 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:115-128 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:51-64 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/blink/parser/BlinkCreateTableParser.java:44` 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:272— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:272-285 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:410-426 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:612-628 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:145— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:145-158 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:347-360 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:472-485 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1811— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1811-1824 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1849-1862 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1875-1888 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1811` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `DrdsRecoverDDLJob` in one and `DrdsRemoveDDLJob` 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:258— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:258-271 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1991-2004 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2484-2497 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:258` 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2503— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2503-2516 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1433-1446 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1810-1823 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2412— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2412-2425 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3107-3120 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2269-2282 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2412` 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, `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2427` calls `getRelations`, `size`, `addAll` and `core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2284` 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 (14 lines × 3) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:97— core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:97-110 | core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:96-109 | core/src/main/java/com/alibaba/druid/support/spring/mvc/StatHandlerInterceptor.java:67-80 — `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:546— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:546-559 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2063-2076 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2556-2569 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (12 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:70— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:70-81 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:122-133 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:302-313 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:314` calls `mark` and `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:83` 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:30— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:30-41 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:50-61 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:50-61 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` as WHOLE FILES: this scan already matched 8 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:30` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:42` calls `setParenthesized` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:63` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:463— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:463-474 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2695-2706 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2830-2841 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java` and `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 187 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:463` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:460` calls `charAt` and `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2694` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2796— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2796-2807 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2814-2825 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2831-2842 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2796` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2811` calls `accept` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2792` 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 (12 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3405— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3405-3416 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4012-4023 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7846-7857 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3405` 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 (12 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:188— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:188-199 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:834-845 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1214-1225 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:188` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:528— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:528-539 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1858-1869 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2248-2259 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `x` to `OracleSelectTableReference` in one and `OracleSelectSubqueryTableSource` 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 (12 lines × 3) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:28— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:28-39 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Left.java:29-40 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Right.java:29-40 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Left.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 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 `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:28` 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 × 3) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:344— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:344-355 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:399-410 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:416-427 — 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 `core/src/main/java/com/alibaba/druid/wall/WallFilter.java:344` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1934— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1934-1945 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3689-3700 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4066-4077 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1934` 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.
Swallowed exception (empty catch) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:116— 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) REDACTED:553— 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) core/src/main/java/com/alibaba/druid/support/opds/udf/ExportTables.java:61— 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) core/src/main/java/com/alibaba/druid/support/logging/LogFactory.java:81— 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) core/src/main/java/com/alibaba/druid/support/logging/LogFactory.java:104— 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) core/src/main/java/com/alibaba/druid/support/logging/LogFactory.java:115— 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:1017— 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) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1044— 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) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1068— 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) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1828— 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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8993— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (5 pts), boolean chains 2, loops 1 (2 pts) (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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1870— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2372— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 7. 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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7132— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (8 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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6526— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (7 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2946— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 2 (4 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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4921— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10769— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5934— SQLASTOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (7 pts), boolean chains 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.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×9
Edited copy of a member (17 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3810— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3810-3853 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6390-6426 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2915— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2915-2931 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2933-2950 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIdentifierExpr.java:157— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIdentifierExpr.java:157-173 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLPropertyExpr.java:284-300 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7127— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7127-7149 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7841-7857 — 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) REDACTED:213— REDACTED:213-229 | REDACTED:231-247 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/functions/IfNull.java:31— core/src/main/java/com/alibaba/druid/sql/visitor/functions/IfNull.java:31-48 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Isnull.java:29-45 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Greatest.java:31— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Greatest.java:31-47 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Least.java:31-47 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:148— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:148-164 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:134-153 — 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) core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:218— core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:218-234 | core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:236-254 — 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 (30 corresponding lines) · ×9
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:373— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:373-402 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUpdateStatement.java:129-161 — 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.
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:19— core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:19-50 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:33-62 — 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.
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:118— core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:118-147 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:450-479 — 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.
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:44— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:44-73 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:691-720 — 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.
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftCreateTableParser.java:20— core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftCreateTableParser.java:20-49 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:41-75 — 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.
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/support/opds/udf/ExportConditionColumns.java:32— core/src/main/java/com/alibaba/druid/support/opds/udf/ExportConditionColumns.java:32-61 | core/src/main/java/com/alibaba/druid/support/opds/udf/ExportTables.java:37-72 — 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.
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionSingle.java:109— core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionSingle.java:109-138 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OraclePartitionSingle.java:181-210 — 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.
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1319— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1319-1352 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1355-1384 — 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.
Edited copy of a member (30 corresponding lines) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:544— core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:544-573 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:424-455 — 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.
Duplicated block (17 lines × 3) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1519— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1519-1535 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1538-1554 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1557-1573 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1519` 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 (17 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionSingle.java:112— core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionSingle.java:112-128 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MysqlPartitionSingle.java:86-102 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OraclePartitionSingle.java:184-200 — 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 (17 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateMaterializedViewStatement.java:436— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateMaterializedViewStatement.java:436-452 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1574-1590 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1614-1630 — 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. 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:269— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:269-285 | core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java:91-107 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7256-7272 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 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 `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:269` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:35— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:35-51 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:33-49 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:83-99 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:35` 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 (17 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:132— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:132-148 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:180-196 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:187-203 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:132` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:277— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:277-293 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1223-1239 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:139-155 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java` as WHOLE FILES: this scan already matched 6 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. 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java:66— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java:66-82 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenFilterStatement.java:65-81 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenizerStatement.java:74-90 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenFilterStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:886— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:886-902 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:982-998 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1362-1378 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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: the declarations holding them bind `x` to `CellAssignmentItem` in one and `ModelClause.CellAssignmentItem` 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 × 4) core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:167— core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:167-176 | core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:186-194 | core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:212-220 | core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:230-239 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:167` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:93— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:93-101 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:114-122 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:135-143 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:119-127 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 262 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:93` 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:77— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:77-85 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:98-106 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:119-127 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:140-148 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:77` 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:252— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:252-260 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2430-2438 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3125-3133 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2284-2292 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:252` 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, `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2427` calls `getRelations`, `size`, `addAll` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:250` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2819— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2819-2828 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3177-3185 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3242-3250 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3385-3394 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2819` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4337— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4337-4345 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4407-4415 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7799-7809 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11697-11706 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4337` 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: the declarations holding them bind `x` to `SQLLoopStatement` in one and `MySqlRepeatStatement` 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 × 4) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ascii.java:30— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ascii.java:30-38 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Bin.java:29-38 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/BitLength.java:29-38 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/OneParamFunctions.java:35-44 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Bin.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/functions/BitLength.java` as WHOLE FILES: 84% 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. 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 `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ascii.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. 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 × 4) REDACTED:307— REDACTED:307-315 | core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:208-216 | REDACTED:287-295 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java:208-216 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 238 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: `HttpServletRequest` names `jakarta.servlet.http.HttpServletRequest` in one and `javax.servlet.http.HttpServletRequest` 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 (9 lines × 4) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:50— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:50-58 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:66-74 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStatUtils.java:34-42 | core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:200-208 — there are 4 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 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 `core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:50` 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.
AC3 · Page structure· Data table has no header cells · ×8
Data table has no header cells core/src/main/resources/support/http/resources/index.html:19— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells core/src/main/resources/support/http/resources/spring-detail.html:21— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells core/src/main/resources/support/http/resources/sql-detail.html:29— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells core/src/main/resources/support/http/resources/sql-detail.html:52— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells core/src/main/resources/support/http/resources/sql-detail.html:68— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells core/src/main/resources/support/http/resources/sql-detail.html:87— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells core/src/main/resources/support/http/resources/wall.html:40— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells core/src/main/resources/support/http/resources/websession-detail.html:20— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Duplicated block (25 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:785— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:785-809 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:288-312 — 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 (25 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:157— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:157-181 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4862-4886 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.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.
Duplicated block (25 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:157— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:157-181 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:914-938 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.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.
Duplicated block (25 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6326— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6326-6350 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6864-6888 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6326` 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1097— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1097-1121 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1190-1214 — 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 (25 lines × 2) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2084— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2084-2108 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2111-2135 — 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. 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 `x` to `SQLCreateFunctionStatement` in one and `SQLCreateProcedureStatement` 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 (25 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropProcedureStatement.java:27— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropProcedureStatement.java:27-64 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLPurgeTemporaryOutputStatement.java:26-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. 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 (25 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/clause/MySqlIterateStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/clause/MySqlIterateStatement.java:1-39 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/clause/MySqlLeaveStatement.java:31-55 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/clause/MySqlIterateStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/clause/MySqlLeaveStatement.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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/clause/MySqlIterateStatement.java:1` 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.
SQLASTOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8138— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8080— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2372— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6390— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11062— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3763— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2862— SQLASTOutputVisitor.visit 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.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×7
Edited copy of a member (23 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:288— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:288-310 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:314-336 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:456— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:456-483 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10690-10712 — 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1549— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1549-1571 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1573-1595 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:185— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:185-211 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:631-653 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/transform/NameResolveVisitor.java:137— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/transform/NameResolveVisitor.java:137-159 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/transform/NameResolveVisitor.java:168-191 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:95— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:95-117 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIntervalExpr.java:109-131 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java:257— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java:257-279 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:205-232 — 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· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×7
Members sharing a duplicated core (5 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:69— core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:69-87 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:93-111 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:115-133 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:138-156 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:162-180 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:232— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:232-277 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2403-2465 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4187-4369 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3097-3154 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2254-2375 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/athena/visitor/AthenaOutputVisitor.java:21— core/src/main/java/com/alibaba/druid/sql/dialect/athena/visitor/AthenaOutputVisitor.java:21-40 | core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:112-134 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:33-75 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:103-118 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4022-4059 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/blink/vsitor/BlinkOutputVisitor.java:46— core/src/main/java/com/alibaba/druid/sql/dialect/blink/vsitor/BlinkOutputVisitor.java:46-84 | core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:130-179 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:707-740 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3949-3965 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11486-11516 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8221— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8221-8296 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8301-8378 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:989-1129 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2796-2885 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:681-741 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:561— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:561-606 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:228-268 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1918-1963 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:208-254 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2411-2456 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1455— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1455-1470 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2208-2223 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2701-2716 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7750-7765 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7768-7790 — 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 copies of one member (3 members, 17+ corresponding lines) · ×7
Edited copies of one member (3 members, 17+ corresponding lines) druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java:36— druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceWrapper.java:36-52 | druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/DruidDataSourceWrapper.java:36-52 | druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceWrapper.java:36-52 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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, 17+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1287— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1287-1303 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:373-389 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8246-8262 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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, 17+ corresponding lines) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:655— core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:655-671 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:675-691 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:694-710 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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, 17+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexDefinition.java:312— core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexDefinition.java:312-330 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:85-101 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java:129-145 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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, 17+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:473— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:473-489 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:491-507 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:509-525 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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, 17+ corresponding lines) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:720— core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:720-738 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:900-917 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:945-961 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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, 17+ corresponding lines) core/src/main/java/com/alibaba/druid/stat/JdbcStatementStat.java:84— core/src/main/java/com/alibaba/druid/stat/JdbcStatementStat.java:84-100 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:238-255 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringMethodStat.java:181-200 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 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.
Duplicated block (23 lines × 2) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:125— core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:125-147 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:457-479 — 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 `core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:125` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `queryBlock` to `SQLUnionQuery` in one and `SQLSelectQueryBlock` 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:253— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:253-275 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java:396-418 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 61 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) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1011— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1011-1033 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1391-1413 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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) core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:198— core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:198-220 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:6515-6537 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:198` 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 (23 lines × 2) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:439— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:439-461 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:534-556 — 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. 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5519— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5519-5541 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5594-5616 — 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 `x` to `SQLAlterViewStatement` in one and `SQLCreateViewStatement` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:667— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:667-689 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:691-713 — 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 (16 lines × 3) core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:376— core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:376-391 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:395-410 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:414-429 — 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. 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 × 3) core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:433— core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:433-448 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:452-467 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:471-486 — 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. 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 × 3) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.java:104— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.java:104-119 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLQueryExpr.java:109-124 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSomeExpr.java:100-115 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLQueryExpr.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 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 (16 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCheck.java:77— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCheck.java:77-92 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnCheck.java:76-91 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDefault.java:91-106 — 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. 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:302— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:302-317 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:263-278 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:87-102 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:302` 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 × 3) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:160— core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:160-175 | core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:159-174 | core/src/main/java/com/alibaba/druid/support/spring/mvc/StatHandlerInterceptor.java:126-141 — `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.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.
Duplicated block (16 lines × 3) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:214— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:214-229 | core/src/main/java/com/alibaba/druid/util/OracleUtils.java:213-228 | core/src/main/java/com/alibaba/druid/util/PGUtils.java:57-72 — 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. 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 × 4) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:173— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:173-184 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:242-253 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:475-486 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:986-997 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:173` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:982` calls `token`, `identifierEquals`, `nextToken` and `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:241` 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 × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:40— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:40-51 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1184-1195 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:38-49 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:88-99 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:40` 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 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, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:38` calls `setType` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1182` 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 (12 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:286— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:286-297 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:605-616 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1135-1146 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.java:41-52 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:286` 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 × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:234— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:234-245 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:372-383 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:369-380 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:162-173 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `DmUpdateStatement` in one and `OscarUpdateStatement` 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 (12 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:160— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:160-171 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:185-196 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:260-271 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:216-227 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:160` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:197` calls `token` and `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:172` 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 (12 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:407— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:407-418 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:358-369 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1197-1208 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1575-1586 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:407` 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: the declarations holding them bind `x` to `OdpsSelectQueryBlock` in one and `OracleSelectQueryBlock` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:370` calls `printInto` and `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:420` 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 × 4) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:285— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:285-296 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1456-1467 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1605-1616 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1807-1818 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:285` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1469` calls `addColumn` and `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:297` 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 (10 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:151— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:151-160 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:227-236 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:460-469 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:958-967 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:151` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:957` calls `setDbType` and `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:149` 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 (10 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:49— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:49-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:258-267 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:69-78 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:68-77 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` as WHOLE FILES: this scan already matched 8 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:49` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:269` calls `parseHints` and `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:60` 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 (10 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:53— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:53-62 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:73-82 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:72-81 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:130-139 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` as WHOLE FILES: this scan already matched 8 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:53` 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) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8600— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8600-8609 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8629-8638 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8651-8660 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8673-8682 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `WhenUpdate` in one and `SQLMergeStatement.WhenDoNothing` 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 (10 lines × 4) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:34— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:34-43 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Left.java:35-44 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Right.java:35-44 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Substring.java:46-55 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Left.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 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 × 4) core/src/main/java/com/alibaba/druid/util/FnvHash.java:187— core/src/main/java/com/alibaba/druid/util/FnvHash.java:187-196 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:238-247 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:311-320 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:345-354 — 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.
Duplicated block (10 lines × 4) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1806— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1806-1816 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1833-1843 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1988-1997 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2144-2153 — 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.
SQLASTOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8031— SQLASTOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 6 (7 pts), 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.
SQLASTOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4876— SQLASTOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 8 (9 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.
SQLASTOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8396— SQLASTOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 6 (7 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.
SQLASTOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3166— SQLASTOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (8 pts), boolean chains 3 (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.
SQLASTOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4451— SQLASTOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 2 (6 pts), boolean chains 3, 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.
SQLASTOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3874— SQLASTOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (6 pts), loops 2 (3 pts) (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.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (6 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:829— core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:829-841 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:847-859 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:863-875 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:880-892 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:898-910 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:914-926 — These 6 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 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLateralViewTableSource.java:114— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLateralViewTableSource.java:114-147 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQueryTableSource.java:73-89 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLValuesTableSource.java:87-117 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlUpdateTableSource.java:55-73 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java:59-83 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGFunctionTableSource.java:59-83 — These 6 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 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:92— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:92-103 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1360-1508 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:537-767 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:234-406 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:422-608 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:58-86 — These 6 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 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5200— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5200-5326 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:205-222 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1291-1331 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4855-5080 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2783-2856 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5002-5151 — These 6 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 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2519— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2519-2556 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2627-2746 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1449-1486 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1549-1652 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1826-1863 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1926-2029 — These 6 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 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:325— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:325-338 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:342-355 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:360-374 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:379-393 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:397-410 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:414-427 — These 6 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 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· Edited copy of a member (27 corresponding lines) · ×6
Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1765— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1765-1795 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3264-3290 — 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.
Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:485— core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:485-512 | core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:623-649 — 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.
Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:178— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseExpr.java:178-204 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseStatement.java:153-179 — 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.
Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/stat/TableStat.java:300— core/src/main/java/com/alibaba/druid/stat/TableStat.java:300-333 | core/src/main/java/com/alibaba/druid/stat/TableStat.java:378-404 — 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.
Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1498— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1498-1530 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1532-1558 — 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.
Edited copy of a member (27 corresponding lines) core/src/main/java/com/alibaba/druid/stat/JdbcConnectionStat.java:201— core/src/main/java/com/alibaba/druid/stat/JdbcConnectionStat.java:201-233 | core/src/main/java/com/alibaba/druid/stat/JdbcResultSetStat.java:112-138 — 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 (18 corresponding lines) · ×6
Edited copy of a member (18 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:483— core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:483-500 | core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:503-525 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSourceImpl.java:202— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSourceImpl.java:202-219 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectJoin.java:61-81 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:354— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:354-376 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:378-395 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1101— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1101-1120 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1122-1139 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1807— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1807-1824 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1871-1888 — 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) core/src/main/java/com/alibaba/druid/util/FnvHash.java:54— core/src/main/java/com/alibaba/druid/util/FnvHash.java:54-71 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:73-90 — 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 (21 corresponding lines) · ×6
Edited copy of a member (21 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:113— core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:113-133 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:112-132 — 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.
Edited copy of a member (21 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:264— core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:264-284 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringMethodStat.java:216-236 — 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.
Edited copy of a member (21 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5514— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5514-5536 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5538-5558 — 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.
Edited copy of a member (21 corresponding lines) REDACTED:70— REDACTED:70-95 | REDACTED:97-117 — 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.
Edited copy of a member (21 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebSessionStat.java:208— core/src/main/java/com/alibaba/druid/support/http/stat/WebSessionStat.java:208-228 | core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:151-173 — 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.
Edited copy of a member (21 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlSchemaStatVisitor.java:99— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlSchemaStatVisitor.java:99-119 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:2920-2941 — 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.
Duplicated block (14–15 lines × 2) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1358— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1358-1371 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1411-1425 — 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 `core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1411` 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 (14–15 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:168— core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:168-182 | core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:213-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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:168` 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–15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:120— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:120-133 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:565-579 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java` as WHOLE FILES: this scan already matched 6 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:120` 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 (14–15 lines × 2) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:245— core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:245-258 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:268-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:260` calls `loadDDL` and `core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:284` 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 (14–15 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ascii.java:29— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ascii.java:29-42 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/OneParamFunctions.java:34-48 — 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 (14–15 lines × 2) core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:635— core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:635-649 | core/src/main/java/com/alibaba/druid/wall/WallTableStat.java:272-285 — 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 `core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:635` 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) core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:933— core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:933-940 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:947-954 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:961-968 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:976-983 — 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 `core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:933` 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 × 4) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:82— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:82-89 | core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:94-101 | core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:112-119 | core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:121-128 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:90` calls `identifierEquals`, `nextToken`, `SQLIntervalExpr` and `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:102` 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) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:102— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:102-110 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:131-139 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:133-141 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:319-326 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java: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.
Duplicated block (8 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAliasedExpr.java:29— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAliasedExpr.java:29-36 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectItem.java:85-92 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectOrderByItem.java:89-97 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/expr/MySqlOrderingExpr.java:59-67 — 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.
Duplicated block (8 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1632— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1632-1639 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java:84-91 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenFilterStatement.java:83-90 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenizerStatement.java:92-99 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenFilterStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 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 × 4) core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLDeleteBuilderImpl.java:86— core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLDeleteBuilderImpl.java:86-93 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:159-166 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:169-176 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLUpdateBuilderImpl.java:89-96 — there are 4 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 4 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 (7–8 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:28— core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:28-34 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2583-2590 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:28` 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 after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:34` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2590` 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–8 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:67— core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:67-74 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.java:93-99 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:67` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2StatementParser.java:66` calls `accept` and `core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.java:92` 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–8 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:208— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:208-214 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2681-2688 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:208` 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–8 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4738— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4738-4744 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4748-4755 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4748` 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 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 (7–8 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5271— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5271-5278 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5316-5322 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5271` 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–8 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:2103— core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:2103-2110 | core/src/main/java/com/alibaba/druid/proxy/jdbc/DataSourceProxyImpl.java:280-286 — 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 `core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:2103` 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 (6 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:489— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:489-495 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3544-3549 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:972-977 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:404-409 — 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.
Duplicated block (6 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:668— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:668-673 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5366-5373 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5434-5441 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5478-5485 — 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. 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 (6 lines × 4) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:275— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:275-280 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1445-1450 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1594-1599 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1797-1802 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:275` 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 × 4) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:71— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:71-76 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.java:74-79 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLQueryExpr.java:68-73 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSomeExpr.java:70-75 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.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. 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 (6 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnPrimaryKey.java:26— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnPrimaryKey.java:26-31 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnReference.java:37-42 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnUniqueKey.java:26-31 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGDropDatabaseStatement.java:50-55 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `visitor` to `SQLASTVisitor` in one and `PGASTVisitor` 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 × 4) core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:137— core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:137-142 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:524-529 | core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:315-320 | core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:323-328 — 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. 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 × 3) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:509— core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:509-513 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:535-539 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:579-583 — 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 `core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:509` 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.
Duplicated block (5 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5127— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5127-5131 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5151-5155 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8069-8074 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5127` 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) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:347— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:347-351 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:371-375 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:414-418 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:347` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:376` calls `nextIf` and `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:352` 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 (5 lines × 3) REDACTED:444— REDACTED:444-448 | REDACTED:467-471 | REDACTED:494-498 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `hash` to `int` in one and `long` 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 (5 lines × 3) REDACTED:447— REDACTED:447-451 | REDACTED:474-478 | REDACTED:501-505 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `hash` to `int` in one and `long` 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 (5 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java:59— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java:59-63 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenFilterStatement.java:58-62 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenizerStatement.java:67-71 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextCharFilterStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextTokenFilterStatement.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 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.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×5
Focus outline removed in CSS without a :focus replacement druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:2137— `.btn-check:focus + .btn` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4105— `.modal` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4146— `.modal-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4599— `.carousel-control-prev:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4742— `.offcanvas` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
SQLASTOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10067— SQLASTOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 6 (8 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.
SQLASTOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7619— SQLASTOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, ternaries 2, loops 1 (nesting depth added 3). 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.
SQLASTOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12457— SQLASTOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 4 (8 pts), loops 1 (2 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.
SQLASTOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6429— SQLASTOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 6 (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.
SQLASTOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8672— SQLASTOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 6 (7 pts) (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.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×5
Edited copy of a member (26 corresponding lines) REDACTED:466— REDACTED:466-491 | REDACTED:493-520 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:158— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:158-183 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:744-775 — 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) core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:142— core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:142-170 | core/src/main/java/com/alibaba/druid/wall/spi/SQLServerWallVisitor.java:80-105 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:237— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:237-262 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropDatabaseStatement.java:106-131 — 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) core/src/main/java/com/alibaba/druid/pool/DruidPooledPreparedStatement.java:203— core/src/main/java/com/alibaba/druid/pool/DruidPooledPreparedStatement.java:203-230 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:292-317 — 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 (32 corresponding lines) · ×5
Edited copy of a member (32 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:260— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:260-291 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:294-325 — 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.
Edited copy of a member (32 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:489— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:489-520 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12457-12497 — 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.
Edited copy of a member (32 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:190— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:190-224 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4960-4991 — 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.
Edited copy of a member (32 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/SQLOver.java:54— core/src/main/java/com/alibaba/druid/sql/ast/SQLOver.java:54-85 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlInsertStatement.java:133-169 — 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.
Edited copy of a member (32 corresponding lines) core/src/main/java/com/alibaba/druid/pool/PoolableWrapper.java:35— core/src/main/java/com/alibaba/druid/pool/PoolableWrapper.java:35-66 | core/src/main/java/com/alibaba/druid/pool/PoolableWrapper.java:70-102 — 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 (28 corresponding lines) · ×5
Edited copy of a member (28 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:129— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:129-156 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:177-212 — 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.
Edited copy of a member (28 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1451— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1451-1482 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1484-1511 — 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.
Edited copy of a member (28 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4146— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4146-4173 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5879-5908 — 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.
Edited copy of a member (28 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/visitor/RedshiftOutputVisitor.java:23— core/src/main/java/com/alibaba/druid/sql/dialect/redshift/visitor/RedshiftOutputVisitor.java:23-50 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:53-80 — 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.
Edited copy of a member (28 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/ExportParameterVisitorUtils.java:37— core/src/main/java/com/alibaba/druid/sql/visitor/ExportParameterVisitorUtils.java:37-65 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:108-135 — 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 copy of a member (29 corresponding lines) · ×5
Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1849— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1849-1877 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2239-2267 — 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.
Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:110— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:110-138 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:403-439 — 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.
Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:307— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:307-335 | core/src/main/java/com/alibaba/druid/util/OracleUtils.java:295-324 — 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.
Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1615— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1615-1652 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1654-1682 — 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.
Edited copy of a member (29 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2364— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2364-2392 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleUpdateParser.java:72-102 — 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 (4 members, 12+ corresponding lines) · ×5
Edited copies of one member (4 members, 12+ corresponding lines) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2877— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2877-2890 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3013-3026 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3137-3148 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:3236-3247 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatManager.java:63— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatManager.java:63-74 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatManager.java:76-87 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatManager.java:89-100 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStatManager.java:69-82 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExceptionStatement.java:67— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExceptionStatement.java:67-78 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLIfStatement.java:172-185 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLWhileStatement.java:78-91 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCreatePackageStatement.java:51-67 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableStatement.java:223— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableStatement.java:223-235 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateDatabaseStatement.java:222-235 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateIndexStatement.java:66-77 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropDatabaseStatement.java:91-104 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlParams.java:21— core/src/main/java/com/alibaba/druid/support/opds/udf/SqlParams.java:21-34 | core/src/main/java/com/alibaba/druid/support/opds/udf/SqlParamsFill.java:20-32 | core/src/main/java/com/alibaba/druid/support/opds/udf/SqlPattern.java:17-28 | core/src/main/java/com/alibaba/druid/support/opds/udf/SqlPatternHash.java:17-28 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Duplicated block (37 lines × 2) core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:167— core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java:167-203 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java:167-203 — `core/src/main/java/com/alibaba/druid/support/http/StatViewServlet.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/StatViewServlet.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 136 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (37 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddExtPartition.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddExtPartition.java:1-37 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropExtPartition.java:1-37 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddExtPartition.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropExtPartition.java` as WHOLE FILES: 84% 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddExtPartition.java:1` 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 (37 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsClearDDLJobCache.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsClearDDLJobCache.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsRecoverDDLJob.java:1-37 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsClearDDLJobCache.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsRecoverDDLJob.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 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. 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsClearDDLJobCache.java:1` 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 (37 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableDiscardTablespace.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableDiscardTablespace.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableImportTablespace.java:1-37 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableDiscardTablespace.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableImportTablespace.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 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. 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableDiscardTablespace.java:1` 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 (37 lines × 2) core/src/main/java/com/alibaba/druid/support/http/MonitorClientContextListener.java:1— core/src/main/java/com/alibaba/druid/support/http/MonitorClientContextListener.java:1-38 | core/src/main/java/com/alibaba/druid/support/jakarta/MonitorClientContextListener.java:1-37 — `core/src/main/java/com/alibaba/druid/support/http/MonitorClientContextListener.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/MonitorClientContextListener.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 38 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/support/http/MonitorClientContextListener.java:1` 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: `ServletContextEvent` names `jakarta.servlet.ServletContextEvent` in one and `javax.servlet.ServletContextEvent` 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 (36 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:281— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:281-316 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2059-2094 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2096` calls `visitAggregateRest` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:318` 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 (36 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2320— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2320-2355 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2411-2446 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2320` 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 (36 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:92— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:92-127 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:272-307 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 294 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:92` 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 (36 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:515— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:515-550 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1035-1070 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:515` 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 (36 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2586— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2586-2621 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2722-2757 — 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 (29 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2627— core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2627-2655 | core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2659-2687 — 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 (29 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:170— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:170-198 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:643-671 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java` as WHOLE FILES: this scan already matched 6 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:170` 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 (29 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:210— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:210-238 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:214-242 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 217 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 (29 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteLexer.java:51— core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteLexer.java:51-79 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:178-206 — 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 (29 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDiscardPartition.java:30— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDiscardPartition.java:30-58 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableImportPartition.java:1-55 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDiscardPartition.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableImportPartition.java` as WHOLE FILES: 92% 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. 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableImportPartition.java:1` 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 (26 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:52— core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:52-77 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:180-205 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 95 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 `core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.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.
Duplicated block (26 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2735— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2735-2760 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7390-7415 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2735` 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 (26 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:40— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:40-65 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:90-115 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:40` 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 (26 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:224— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:224-249 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:229-254 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 217 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:224` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:228` calls `nextToken` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:223` 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 (26 lines × 2) REDACTED:273— REDACTED:273-298 | REDACTED:253-278 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 238 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5624— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5624-5646 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2939-2961 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8081-8103 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MysqlPartitionSingle` in one and `OraclePartitionSingle` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2964` calls `printOracleSegmentAttributes` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8105` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:860— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:860-882 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:956-978 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1336-1358 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:860` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `ModelRulesClause` in one and `ModelClause.ModelRulesClause` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1003— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1003-1025 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1125-1147 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1505-1527 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 × 3) druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidStatViewServletConfiguration.java:35— druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidStatViewServletConfiguration.java:35-57 | druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/stat/DruidStatViewServletConfiguration.java:35-57 | druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/stat/DruidStatViewServletConfiguration.java:35-57 — before extracting anything, compare `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidStatViewServletConfiguration.java` and `druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/stat/DruidStatViewServletConfiguration.java` as WHOLE FILES: 95% 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. 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: `DruidStatProperties` names `com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties` in one and `com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties` 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 (23 lines × 3) druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidWebStatFilterConfiguration.java:33— druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidWebStatFilterConfiguration.java:33-55 | druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/stat/DruidWebStatFilterConfiguration.java:33-55 | druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/stat/DruidWebStatFilterConfiguration.java:33-55 — before extracting anything, compare `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidWebStatFilterConfiguration.java` and `druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/stat/DruidWebStatFilterConfiguration.java` as WHOLE FILES: 95% 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. 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: `DruidStatProperties` names `com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties` in one and `com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties` 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 (18 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:299— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:299-316 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:623-640 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1153-1170 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:299` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:610— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:610-627 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1967-1984 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2460-2477 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2758— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2758-2775 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2176-2193 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2669-2686 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 × 3) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:252— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:252-269 | core/src/main/java/com/alibaba/druid/util/OracleUtils.java:231-248 | core/src/main/java/com/alibaba/druid/util/PGUtils.java:35-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 all 3 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/util/OracleUtils.java:250` calls `getTableDDL`, `asList` and `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:271` 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 × 3) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:515— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:515-532 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:537-554 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:559-576 — 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. 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–17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:789— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:789-805 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:277-292 — 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 (16–17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:209— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:209-224 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:287-303 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:209` 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–17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:164— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:164-179 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:156-172 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 217 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:164` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:163` calls `setLimit` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:154` 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 (16–17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1249— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1249-1265 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1338-1353 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1249` 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 (16–17 lines × 2) core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:82— core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:82-98 | core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:155-170 — 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 `core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:82` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLPropertyExpr` in one and `SQLVariantRefExpr` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:81` calls `checkVar`, `getParent`, `getName` and `core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:153` 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–14 lines × 2) core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:74— core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:74-87 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:144-156 — 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 `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.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. 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, `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:141` calls `findColumn` and `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.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–14 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:155— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:155-168 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:228-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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:155` 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.
Duplicated block (13–14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:369— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:369-381 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:417-430 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:369` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `item` to `MySqlAlterTableChangeColumn` in one and `MySqlAlterTableModifyColumn` 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 (13–14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1154— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1154-1167 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6006-6018 — 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 (13–14 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:533— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:533-546 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:907-919 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:533` 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–13 lines × 2) core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:99— core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:99-111 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:169-180 — 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 `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:99` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:165` calls `findColumn` and `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.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.
Duplicated block (12–13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:962— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:962-973 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:986-998 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:962` 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–13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1181— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1181-1193 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1212-1223 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1181` 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.
Duplicated block (12–13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:389— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:389-401 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1261-1272 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:389` 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 (12–13 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4440— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4440-4451 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4474-4486 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4440` 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, `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4451` calls `parseDataTypeRest` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4486` 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–10 lines × 2) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:600— core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:600-609 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:798-806 — 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–10 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLValuesTableSource.java:129— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLValuesTableSource.java:129-138 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLWithSubqueryClause.java:157-165 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLValuesTableSource.java:129` 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–10 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:948— core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:948-957 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1176-1184 — 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–10 lines × 2) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1151— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1151-1160 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1168-1176 — 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 `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1151` 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) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:441— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:441-450 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:523-531 — 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 `core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:441` 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.
X27 · Collection changed while being enumerated· Collection is structurally changed while it is being enumerated · ×5
Collection is structurally changed while it is being enumerated core/src/main/java/com/alibaba/druid/wall/WallProviderStatValue.java:151— `this.tables` is enumerated directly, and line 153 calls `this.tables.add(…)` inside the loop body — a structural change to a `ArrayList`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen.
Collection is structurally changed while it is being enumerated core/src/main/java/com/alibaba/druid/wall/WallProviderStatValue.java:160— `this.functions` is enumerated directly, and line 162 calls `this.functions.add(…)` inside the loop body — a structural change to a `ArrayList`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen.
Collection is structurally changed while it is being enumerated core/src/main/java/com/alibaba/druid/wall/WallProviderStatValue.java:169— `this.blackList` is enumerated directly, and line 170 calls `this.blackList.add(…)` inside the loop body — a structural change to a `ArrayList`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen.
Collection is structurally changed while it is being enumerated core/src/main/java/com/alibaba/druid/wall/WallProviderStatValue.java:177— `this.whiteList` is enumerated directly, and line 178 calls `this.whiteList.add(…)` inside the loop body — a structural change to a `ArrayList`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen.
Collection is structurally changed while it is being enumerated core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:73— `supportOptions` is enumerated directly, and line 74 calls `supportOptions.add(…)` inside the loop body — a structural change to a `HashSet`. The loop's hidden iterator is fail-fast, so its next `next()` throws `ConcurrentModificationException`: every pass that reaches this call ends the loop by exception instead of by running out of elements, and the remaining elements are never seen.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×4
Animation without a prefers-reduced-motion guard druid-demo-petclinic/src/main/scss/petclinic.scss:192— `.myspinner` moves (`animation-name: spinner`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4699— `.spinner-border` moves (`animation: 0.75s linear infinite spinner-border`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:4721— `.spinner-grow` moves (`animation: 0.75s linear infinite spinner-grow`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:7869— `.myspinner` moves (`animation-name: spinner`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
SQLASTOutputVisitor.visit (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2058— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10018— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2595— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11105— SQLASTOutputVisitor.visit 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.
FixmeComment core/src/test/java/com/alibaba/druid/bvt/sql/mysql/AntlrMySqlTest.java:26— //FIXME 此处是否要禁用审核h — 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.
FixmeComment core/src/test/java/com/alibaba/druid/bvt/sql/mysql/AntlrMySqlTest.java:27— //FIXME 此处是否要禁用审核 — 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.
FixmeComment core/src/test/java/com/alibaba/druid/bvt/filter/wall/mysql/MySqlWallTest72.java:46— //FIXME /**/ — 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.
FixmeComment core/src/test/java/com/alibaba/druid/bvt/filter/wall/mysql/MySqlWallTest90.java:38— //FIXME 不知此测试用例的真实意图 — 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.
MySqlOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:446— MySqlOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 5 (16 pts), if/else 8 (15 pts), loops 1 (3 pts) (nesting depth added 20). 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.
MySqlOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:725— MySqlOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 5, loops 2 (3 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.
MySqlOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5170— MySqlOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 9 (21 pts), if/else 9 (13 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.
MySqlOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5098— MySqlOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 12 (23 pts), if/else 11 (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.
SQLASTOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2280— SQLASTOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 2, 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.
SQLASTOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5516— SQLASTOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 8 (10 pts), boolean chains 2, loops 1 (2 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.
SQLASTOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11922— SQLASTOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 7 (18 pts), if/else 7 (9 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.
SQLASTOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11105— SQLASTOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 9 (10 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.
SQLASTOutputVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7319— SQLASTOutputVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 5 (11 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.
SQLASTOutputVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6390— SQLASTOutputVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 6 (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.
SQLASTOutputVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11711— SQLASTOutputVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 6 (8 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.
SQLASTOutputVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6735— SQLASTOutputVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 3 (6 pts), loops 2 (5 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.
SQLASTOutputVisitor.visit (cognitive 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7403— SQLASTOutputVisitor.visit has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 8 (10 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.
SQLASTOutputVisitor.visit (cognitive 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3763— SQLASTOutputVisitor.visit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, ternaries 4 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 5). 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.
SQLASTOutputVisitor.visit (cognitive 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6652— SQLASTOutputVisitor.visit has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 6 (9 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.
SQLASTOutputVisitor.visit (cognitive 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2595— SQLASTOutputVisitor.visit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9, ternaries 5 (9 pts), boolean chains 4 (nesting depth added 4). 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.
MySqlOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1601— MySqlOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 6, 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.
MySqlOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3176— MySqlOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 5 (8 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.
MySqlOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2900— MySqlOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 7 (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.
MySqlOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3092— MySqlOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 4 (6 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.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×4
Edited copy of a member (22 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1176— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1176-1215 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1284-1341 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:357— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:357-384 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:257-278 — 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) core/src/main/java/com/alibaba/druid/wall/WallProvider.java:159— core/src/main/java/com/alibaba/druid/wall/WallProvider.java:159-184 | core/src/main/java/com/alibaba/druid/wall/WallProvider.java:186-207 — 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) core/src/main/java/com/alibaba/druid/mock/MockDriver.java:124— core/src/main/java/com/alibaba/druid/mock/MockDriver.java:124-145 | core/src/main/java/com/alibaba/druid/proxy/DruidDriver.java:85-113 — 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· Edited copy of a member (20 corresponding lines) · ×4
Edited copy of a member (20 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:923— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:923-944 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1134-1153 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:419— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:419-444 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:3083-3102 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:109— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryExpr.java:109-128 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTextLiteralExpr.java:50-69 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:786— core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:786-805 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:863-882 — 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 (3 members, 12+ corresponding lines) · ×4
Edited copies of one member (3 members, 12+ corresponding lines) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:505— core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:505-516 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:553-564 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:575-586 — 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) core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:185— core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:185-199 | core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:229-244 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:460-471 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/DB2CreateTableStatement.java:111— core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/stmt/DB2CreateTableStatement.java:111-122 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCreateTableStatement.java:309-320 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleMultiInsertStatement.java:183-194 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3730— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3730-3741 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10344-10356 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10359-10371 — 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) · ×4
Edited copies of one member (3 members, 9+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLForeignKeyImpl.java:110— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLForeignKeyImpl.java:110-118 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MysqlForeignKey.java:52-62 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleForeignKey.java:40-51 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:225— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:225-233 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/ast/stmt/DmInsertStatement.java:22-30 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/ast/stmt/DmUpdateStatement.java:22-32 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLReplaceStatement.java:152— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLReplaceStatement.java:152-160 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/ast/HiveInsert.java:91-99 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/ast/HiveInsertStatement.java:51-60 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:136— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:136-145 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:109-117 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeLexer.java:167-176 — 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 (4 members, 7+ corresponding lines) · ×4
Edited copies of one member (4 members, 7+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:86— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:86-92 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIntervalExpr.java:100-106 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:198-205 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGAttrExpr.java:86-93 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 7+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/SQLSubPartitionByList.java:24— core/src/main/java/com/alibaba/druid/sql/ast/SQLSubPartitionByList.java:24-30 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAlterColumn.java:40-47 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableRenameColumn.java:30-36 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableAlterColumn.java:31-37 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 7+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTablePartitionSetProperties.java:43— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTablePartitionSetProperties.java:43-50 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableRenamePartition.java:47-53 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/clause/PartitionExtensionClause.java:51-57 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTableSplitPartition.java:92-98 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 7+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:36— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:36-42 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.java:39-45 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExistsExpr.java:111-120 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSomeExpr.java:39-45 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Duplicated block (42 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1669— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1669-1710 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2059-2100 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1669` 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 (42 lines × 2) REDACTED:69— REDACTED:69-110 | REDACTED:56-97 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 238 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:69` 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 (42 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowVariantsStatement.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowVariantsStatement.java:1-67 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowStatusStatement.java:28-69 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowVariantsStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowStatusStatement.java` as WHOLE FILES: 86% 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowVariantsStatement.java:1` 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 (42 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGAnalyzeStatement.java:36— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGAnalyzeStatement.java:36-77 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGVacuumStatement.java:45-150 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGAnalyzeStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGVacuumStatement.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.
Duplicated block (33 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:317— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:317-349 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:140-172 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.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 (33 lines × 2) core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:168— core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:168-200 | core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java:167-199 — `core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 117 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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: `Cookie` names `jakarta.servlet.http.Cookie` in one and `javax.servlet.http.Cookie` 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 (33 lines × 2) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1006— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1006-1038 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1459-1491 — 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 `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1006` 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 (33 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1397— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1397-1429 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2074-2106 — 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 `x` to `MySqlLoadDataInFileStatement` in one and `MySqlOutFileExpr` 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 (31 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:204— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:204-234 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:829-859 — 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:200` calls `identifierEquals`, `setZOrderBy`, `parseZOrderBy` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:826` 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 (31 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1388— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1388-1418 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1761-1791 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1388` 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 (31 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lpad.java:30— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lpad.java:30-60 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Rpad.java:34-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. 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, `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lpad.java:61` calls `length` and `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Rpad.java:65` 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 (31 lines × 2) core/src/main/java/com/alibaba/druid/util/DruidWebUtils.java:24— core/src/main/java/com/alibaba/druid/util/DruidWebUtils.java:24-54 | core/src/main/java/com/alibaba/druid/util/DruidWebUtils.java:57-87 — 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. 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 `request` to `HttpServletRequest` in one and `jakarta.servlet.http.HttpServletRequest` 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 (30 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:823— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:823-852 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:936-965 — 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 (30 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2343— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2343-2372 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:704-733 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2343` 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) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:146— core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:146-175 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:197-226 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/stat/DruidStatService.java` and `druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 108 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 `core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:146` 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 (30 lines × 2) REDACTED:306— REDACTED:306-335 | REDACTED:286-315 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 238 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:306` 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 (27 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:109— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:109-135 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:155-181 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:159-185 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1760-1786 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 89 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:109` 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 (27 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:185— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:185-211 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:553-579 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:121-147 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:125-151 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 238 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:185` 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 after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:582` calls `putChar` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:214` 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 (27 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:463— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:463-489 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:554-580 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2335-2361 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:696-722 — there are 4 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 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:463` 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 (27 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableSetFileFormat.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableSetFileFormat.java:1-27 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAlterTableChangeOwner.java:1-28 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAlterTableSetChangeLogs.java:1-28 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAlterTableSetFileFormat.java:1-28 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAlterTableChangeOwner.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAlterTableSetChangeLogs.java` as WHOLE FILES: 94% 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableSetFileFormat.java:1` 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 (25 lines × 3) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:464— core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:464-488 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:495-519 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:526-550 — 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 `core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:464` 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 (25 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:240— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:240-264 | core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java:62-86 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7230-7254 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 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 `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.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.
Duplicated block (25 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:701— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:701-725 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:343-367 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1531-1555 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:701` 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 (25 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:975— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:975-999 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1097-1121 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1477-1501 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:975` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `InsertIntoClause` in one and `OracleMultiInsertStatement.InsertIntoClause` 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 (14 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:89— core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:89-102 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:274-287 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:93-106 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:408-421 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 95 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 (14 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:689— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:689-702 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:723-736 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1000-1013 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1038-1051 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:689` 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 (14 lines × 4) REDACTED:86— REDACTED:86-99 | core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:71-84 | REDACTED:73-86 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:70-83 — before extracting anything, compare `REDACTED` and `core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 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 `REDACTED:86` 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 (14 lines × 4) REDACTED:106— REDACTED:106-119 | core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:91-104 | REDACTED:93-106 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:90-103 — before extracting anything, compare `REDACTED` and `core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 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 `REDACTED:106` 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–11 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:226— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:226-235 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:396-406 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:598-608 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:226` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:134— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:134-143 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:328-338 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:453-463 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 (10–11 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1697— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1697-1707 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3429-3439 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10212-10221 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1697` 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: the declarations holding them bind `x` to `MySqlShowStatusStatement` in one and `SQLShowVariantsStatement` 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 (10–11 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3307— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3307-3317 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3327-3337 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3344-3353 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3307` 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 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, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3327` calls `setLimit`, `parseLimit` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3344` 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 (10–11 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:222— core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:222-231 | core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:269-279 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:222` 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:288— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:288-298 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:521-530 — 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:519` calls `accept` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:287` 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 (10–11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8117— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8117-8126 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8131-8141 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8117` 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 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 (10–11 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1432— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1432-1441 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1492-1502 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1432` 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) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:196— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:196-202 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:363-369 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:122-128 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:490-496 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1801-1807 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2092-2098 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 176 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:196` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:120` calls `scanString` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:193` 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 × 6) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:84— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:84-90 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:410-416 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:361-367 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1200-1206 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1578-1584 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:56-62 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `x` to `DmSelectQueryBlock` in one and `OdpsSelectQueryBlock` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:82` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:408` 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 × 6) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:738— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:738-744 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:747-753 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:861-867 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:869-875 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1241-1247 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1249-1255 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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 `x` to `OracleBinaryFloatExpr` in one and `OracleBinaryDoubleExpr` 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 × 6) core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoAlterFunctionStatement.java:46— core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoAlterFunctionStatement.java:46-52 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoAlterSchemaStatement.java:31-37 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoDeallocatePrepareStatement.java:39-45 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoExecuteStatement.java:50-56 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoPrepareStatement.java:68-74 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoSelectStatement.java:40-46 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoDeallocatePrepareStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/presto/ast/stmt/PrestoExecuteStatement.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.
Duplicated block (7 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:622— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:622-628 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5352-5359 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5420-5427 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5464-5471 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:622` 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.
Duplicated block (7 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:589— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:589-595 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:254-260 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1946-1952 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2439-2445 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `x` to `OracleUpdateStatement` in one and `OscarDeleteStatement` 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 × 4) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:397— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:397-403 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:437-443 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:479-485 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:618-624 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:397` 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) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:454— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:454-460 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:476-482 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:534-540 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:588-594 — 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 `core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:454` 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.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×4
Untrusted text written into markup unescaped core/src/main/resources/support/http/resources/js/common.js:107— `html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped core/src/main/resources/support/http/resources/js/common.js:119— `html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped druid-admin/src/main/resources/support/http/resources/js/common.js:114— `html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped druid-admin/src/main/resources/support/http/resources/js/common.js:126— `html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
SQLASTOutputVisitor.visit (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3536— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7019— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4531— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9213— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6259— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3406— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6814— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10884— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6190— SQLASTOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5463— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4040— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1716— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5623— MySqlOutputVisitor.visit has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 17 (20 pts), loops 1 (2 pts) (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.
MySqlOutputVisitor.visit (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2065— MySqlOutputVisitor.visit has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 10 (26 pts), if/else 9 (16 pts), boolean chains 2 (nesting depth added 23). 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.
MySqlOutputVisitor.visit (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1015— MySqlOutputVisitor.visit has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 11 (23 pts), if/else 15 (17 pts), loops 2 (3 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8080— SQLASTOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (10 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.
SQLASTOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1734— SQLASTOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (6 pts), ternaries 2 (4 pts) (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.
SQLASTOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9815— SQLASTOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 3 (7 pts), loops 2 (3 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 20) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3243— SQLASTOutputVisitor.visit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, loops 1 (2 pts) (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.
SQLASTOutputVisitor.visit (cognitive 20) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2862— SQLASTOutputVisitor.visit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 4). 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.
SQLASTOutputVisitor.visit (cognitive 20) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10246— SQLASTOutputVisitor.visit has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 7 (8 pts), loops 1 (2 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.
SQLASTOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4146— SQLASTOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 5 (6 pts), loops 1 (2 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.
SQLASTOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11288— SQLASTOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 5 (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.
SQLASTOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10206— SQLASTOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 5 (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.
MySqlOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3595— MySqlOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 2 (5 pts), boolean chains 3, loops 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.
MySqlOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1541— MySqlOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6, boolean chains 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.
MySqlOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4877— MySqlOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (8 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.
OdpsOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1197— OdpsOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, loops 2 (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.
OdpsOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1143— OdpsOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, ternaries 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.
OdpsOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:796— OdpsOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5 (6 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.
Change-coupling hub: SQLServerStatementParser.java → SQLServerASTVisitor.java, SQLServerOutputVisitor.java, SQLServerSchemaStatVisitor.java core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java— `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java` changes together with 3 other files — `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerASTVisitor.java`, `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java`, `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerSchemaStatVisitor.java` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: OdpsOutputVisitor.java → OdpsCreateTableParser.java, OdpsSelectParser.java, OdpsStatementParser.java core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java— `core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java` changes together with 3 other files — `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java`, `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java`, `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: SQLASTOutputVisitor.java → BigQueryStatementParser.java, HiveCreateTableParser.java, SQLServerSelectParser.java, SQLServerASTVisitor.java, SQLCreateTableParser.java core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java— `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` changes together with 5 other files — `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java`, `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java`, `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java`, `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerASTVisitor.java`, `core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 5.
D4 · Code Duplication· Edited copy of a member (47 corresponding lines) · ×3
Edited copy of a member (47 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:239— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:239-285 | core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java:61-107 — These two members are one piece of code written twice and then edited apart: 47 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 (47 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2222— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2222-2280 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5115-5161 — These two members are one piece of code written twice and then edited apart: 47 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 (47 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java:20— core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java:20-68 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java:178-224 — These two members are one piece of code written twice and then edited apart: 47 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) · ×3
Edited copy of a member (33 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1367— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1367-1449 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2065-2109 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:301— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:301-333 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:833-874 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:503— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:503-535 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:537-569 — 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 (37 corresponding lines) · ×3
Edited copy of a member (37 corresponding lines) druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:67— druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:67-103 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:111-147 — 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.
Edited copy of a member (37 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:174— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:174-212 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:349-385 — 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.
Edited copy of a member (37 corresponding lines) core/src/main/java/com/alibaba/druid/support/monitor/MonitorClient.java:223— core/src/main/java/com/alibaba/druid/support/monitor/MonitorClient.java:223-262 | core/src/main/java/com/alibaba/druid/support/monitor/MonitorClient.java:302-338 — 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 (45 corresponding lines) · ×3
Edited copy of a member (45 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1765— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1765-1812 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:1016-1060 — 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) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7493— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7493-7537 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7539-7585 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:367— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:367-411 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:413-463 — 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 (39 corresponding lines) · ×3
Edited copy of a member (39 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5490— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5490-5528 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5530-5568 — These two members are one piece of code written twice and then edited apart: 39 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 (39 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:58— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:58-96 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlHintStatement.java:98-142 — These two members are one piece of code written twice and then edited apart: 39 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 (39 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:452— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:452-505 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:746-784 — These two members are one piece of code written twice and then edited apart: 39 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 (31 corresponding lines) · ×3
Edited copy of a member (31 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:822— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:822-852 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1202-1232 — These two members are one piece of code written twice and then edited apart: 31 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 (31 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:508— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:508-550 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:281-311 — These two members are one piece of code written twice and then edited apart: 31 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 (31 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeLexer.java:184— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeLexer.java:184-216 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2377-2407 — These two members are one piece of code written twice and then edited apart: 31 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 (24 corresponding lines) · ×3
Edited copy of a member (24 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Greatest.java:49— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Greatest.java:49-72 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Least.java:49-72 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:481— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:481-504 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:523-554 — 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) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:49— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:49-72 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:74-99 — 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· Edited copies of one member (3 members, 16+ corresponding lines) · ×3
Edited copies of one member (3 members, 16+ corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:484— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:484-499 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:501-522 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStat.java:66-81 — 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.
Edited copies of one member (3 members, 16+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:36— core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:36-51 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:53-69 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:71-89 — 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.
Edited copies of one member (3 members, 16+ corresponding lines) core/src/main/java/com/alibaba/druid/stat/JdbcConnectionStat.java:96— core/src/main/java/com/alibaba/druid/stat/JdbcConnectionStat.java:96-114 | core/src/main/java/com/alibaba/druid/stat/JdbcConnectionStat.java:116-134 | core/src/main/java/com/alibaba/druid/stat/JdbcConnectionStat.java:144-159 — 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) · ×3
Edited copies of one member (3 members, 14+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1064— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1064-1082 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1275-1288 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1652-1665 — 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.
Edited copies of one member (3 members, 14+ corresponding lines) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:431— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:431-444 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:449-463 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:468-482 — 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.
Edited copies of one member (3 members, 14+ corresponding lines) core/src/main/java/com/alibaba/druid/stat/DruidDataSourceStatManager.java:248— core/src/main/java/com/alibaba/druid/stat/DruidDataSourceStatManager.java:248-261 | core/src/main/java/com/alibaba/druid/stat/JdbcDataSourceStat.java:256-269 | core/src/main/java/com/alibaba/druid/stat/JdbcDataSourceStat.java:305-318 — 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 (3 members, 20+ corresponding lines) · ×3
Edited copies of one member (3 members, 20+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNotExpr.java:83— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNotExpr.java:83-102 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLUnaryExpr.java:92-114 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleOuterExpr.java:94-113 — 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.
Edited copies of one member (3 members, 20+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGSchemaStatVisitor.java:45— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGSchemaStatVisitor.java:45-69 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGSchemaStatVisitor.java:72-95 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGSchemaStatVisitor.java:111-130 — 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.
Edited copies of one member (3 members, 20+ corresponding lines) core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:291— core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:291-310 | core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:312-333 | core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:335-356 — 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, 18+ corresponding lines) · ×3
Edited copies of one member (3 members, 18+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDbLinkExpr.java:118— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDbLinkExpr.java:118-139 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:106-123 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLPropertyExpr.java:108-128 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 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, 18+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8664— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8664-8689 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:964-981 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:790-810 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 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, 18+ corresponding lines) core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:207— core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:207-224 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:226-247 | core/src/main/java/com/alibaba/druid/pool/DruidPooledStatement.java:249-266 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 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) · ×3
Edited copies of one member (3 members, 13+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:50— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:50-62 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Length.java:49-61 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ucase.java:49-61 — 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.
Edited copies of one member (3 members, 13+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnReference.java:60— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnReference.java:60-80 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSupplementalLogGrp.java:73-85 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/ast/StarRocksIndexDefinition.java:72-85 — 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.
Edited copies of one member (3 members, 13+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLArrayExpr.java:47— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLArrayExpr.java:47-61 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:43-55 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java:57-69 — 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, 10+ corresponding lines) · ×3
Edited copies of one member (3 members, 10+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:1108— core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:1108-1122 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:1142-1152 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:1154-1163 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5308— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5308-5319 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1083-1092 | core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java:870-879 — 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) core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxyImpl.java:207— core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxyImpl.java:207-216 | core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:102-111 | core/src/main/java/com/alibaba/druid/proxy/jdbc/StatementProxyImpl.java:57-66 — 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· Edited copies of one member (3 members, 7+ corresponding lines) · ×3
Edited copies of one member (3 members, 7+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:170— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:170-177 | core/src/main/java/com/alibaba/druid/stat/TableStat.java:290-297 | core/src/main/java/com/alibaba/druid/stat/TableStat.java:369-375 — 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) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateUserStatement.java:73— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateUserStatement.java:73-79 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateUserStatement.java:116-123 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsShowGrantsStmt.java:35-41 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/clause/OracleReturningClause.java:53— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/clause/OracleReturningClause.java:53-59 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/clause/SearchClause.java:68-74 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleMultiInsertStatement.java:113-119 — 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 copies of one member (3 members, 8+ corresponding lines) · ×3
Edited copies of one member (3 members, 8+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:98— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:98-105 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCreateIndexStatement.java:119-128 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OraclePrimaryKey.java:39-47 — 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.
Edited copies of one member (3 members, 8+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExportTableStatement.java:58— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExportTableStatement.java:58-66 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLImportTableStatement.java:63-72 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleLockTableStatement.java:84-91 — 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.
Edited copies of one member (3 members, 8+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:34— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExtractExpr.java:34-41 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIntervalExpr.java:38-45 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSizeExpr.java:83-92 — 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 (5 corresponding lines) · ×3
Edited copy of a member (5 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAliasedExpr.java:143— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAliasedExpr.java:143-147 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleIsOfTypeExpr.java:50-54 — 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.
Edited copy of a member (5 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAssignItem.java:51— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAssignItem.java:51-55 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateSetItem.java:148-152 — 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.
Edited copy of a member (5 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1207— core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1207-1211 | core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:859-864 — 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 copy of a member (4 corresponding lines) · ×3
Edited copy of a member (4 corresponding lines) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:177— core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:177-180 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:254-257 — 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) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:199— core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:199-202 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:298-301 — 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) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:204— core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:204-207 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:303-306 — 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.
Duplicated block (63 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:207— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:207-269 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:311-373 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 247 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:207` 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 (63 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:341— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:341-403 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:543-605 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 294 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:341` 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 (63 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropPartition.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropPartition.java:1-63 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableMergePartition.java:1-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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropPartition.java:1` 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 (49 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1987— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1987-2035 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2480-2528 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 (49 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:617— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:617-665 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9816-9864 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:617` 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 (49 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:351— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:351-399 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:348-396 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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: the declarations holding them bind `x` to `OscarUpdateStatement` in one and `PGUpdateStatement` 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 (44 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateTimeExpr.java:94— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateTimeExpr.java:94-137 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimeExpr.java:106-149 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateTimeExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimeExpr.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. 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 (44 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:320— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:320-363 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:445-488 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:320` 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 (44 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateRoleStatement.java:31— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateRoleStatement.java:31-74 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropRoleStatement.java:29-81 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateRoleStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropRoleStatement.java` as WHOLE FILES: 84% 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. 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 (38 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/phoenix/parser/PhoenixStatementParser.java:39— core/src/main/java/com/alibaba/druid/sql/dialect/phoenix/parser/PhoenixStatementParser.java:39-76 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:95-132 — 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 (38 lines × 2) core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:87— core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:87-124 | core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java:86-123 — `core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 117 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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: `HttpServletRequest` names `jakarta.servlet.http.HttpServletRequest` in one and `javax.servlet.http.HttpServletRequest` 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 (38 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterPackageStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterPackageStatement.java:1-57 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleDropPackageStatement.java:1-38 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterPackageStatement.java:1` 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 (35 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:179— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:179-213 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:547-581 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 238 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:179` 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 (35 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1221— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1221-1255 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1601-1635 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1221` 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 (35 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1679— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1679-1713 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1747-1781 — 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 (34 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:596— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:596-629 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1126-1159 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:596` 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 (34 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6353— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6353-6386 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6891-6924 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6353` 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 (34 lines × 2) REDACTED:337— REDACTED:337-370 | REDACTED:318-351 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 238 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:337` 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 (27 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1190— core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1190-1216 | core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1219-1245 — 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. 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 (27 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:826— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:826-852 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1206-1232 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:826` 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 (27 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:991— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:991-1017 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:1047-1073 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:991` 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 (22 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2770— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2770-2791 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4794-4815 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7437-7458 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2770` 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 (22 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2568— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2568-2589 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1490-1511 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1867-1888 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 × 3) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:388— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:388-409 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:428-449 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:470-491 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:388` 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 (19–20 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:813— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:813-831 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:302-321 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:813` 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 (19–20 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:900— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:900-919 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:924-942 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:900` 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–20 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4986— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4986-5005 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5031-5049 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4986` 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 × 3) core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:39— core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:39-63 | core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:33-51 | core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java:48-67 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java` and `core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 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 `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:39` 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, `core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java:46` calls `abs`, `getErrorCode` and `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:37` 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 (19 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:250— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:250-268 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:361-379 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:276-294 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:250` 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 (19 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2606— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2606-2624 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1528-1546 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1905-1923 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (17–18 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLGeneratedTableSource.java:39— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLGeneratedTableSource.java:39-55 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnnestTableSource.java:111-128 — 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 (17–18 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3837— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3837-3853 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6409-6426 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3837` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MysqlForeignKey` in one and `SQLColumnReference` 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 (17–18 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2598— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2598-2615 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2625-2641 — 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 (12–14 lines × 3) core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:438— core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:438-451 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:467-478 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:490-501 — 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 `core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:438` 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–14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4675— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4675-4688 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6763-6774 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9886-9899 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLCreateProcedureStatement` in one and `SQLDropFunctionStatement` 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 (12–14 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:542— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:542-555 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:560-573 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:574-585 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:542` 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 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 (13 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:411— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:411-423 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1512-1524 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2265-2277 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2758-2770 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:411` 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 (13 lines × 4) core/src/main/java/com/alibaba/druid/util/FnvHash.java:117— core/src/main/java/com/alibaba/druid/util/FnvHash.java:117-129 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:206-218 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:295-307 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:329-341 — 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.
Duplicated block (13 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:70— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:70-82 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateTimeExpr.java:36-48 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimeExpr.java:42-54 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:54-66 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 262 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–13 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:320— core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:320-332 | core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:369-380 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCharacterDataType.java:140-151 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:320` 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–13 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLoopStatement.java:79— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLoopStatement.java:79-90 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleExitStatement.java:71-82 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OraclePipeRowStatement.java:54-66 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLoopStatement.java:79` 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 (12–13 lines × 3) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:487— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:487-499 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:507-518 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStat.java:69-81 — 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 `core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:487` 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. 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 (10–12 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:23— core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:23-32 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:36-45 | core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:218-229 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hologres/parser/HologresCreateTableParser.java:23` 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–12 lines × 3) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3903— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3903-3912 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7021-7032 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7099-7110 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3903` 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.
Duplicated block (10–12 lines × 3) core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:84— core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:84-95 | core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:157-166 | core/src/main/java/com/alibaba/druid/wall/spi/SQLServerWallVisitor.java:93-102 — 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 `core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:84` 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: the declarations holding them bind `x` to `SQLPropertyExpr` in one and `SQLVariantRefExpr` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:81` calls `checkVar`, `getParent`, `getName` and `core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:153` 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–12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1360— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1360-1371 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1393-1403 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1393` 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.
Duplicated block (11–12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5128— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5128-5139 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5152-5162 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5128` 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. 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 (11–12 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2569— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2569-2580 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2599-2609 — 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 (11 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:326— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:326-336 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4010-4020 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:443-453 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7844-7854 — 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.
Duplicated block (11 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:568— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:568-578 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:741-751 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:772-782 | core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:811-821 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:568` 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 × 4) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6733— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6733-6743 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6752-6762 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6771-6781 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6817-6827 — 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.
Duplicated block (9 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/athena/visitor/AthenaOutputVisitor.java:22— core/src/main/java/com/alibaba/druid/sql/dialect/athena/visitor/AthenaOutputVisitor.java:22-30 | core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:113-127 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:34-48 | core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:104-116 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4023-4037 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 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 `x` to `AthenaCreateTableStatement` in one and `SQLCreateTableStatement` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/athena/visitor/AthenaOutputVisitor.java:32` calls `printComment`, `getComment` and `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:129` 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 × 5) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:56— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:56-64 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.java:59-67 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExistsExpr.java:62-70 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLQueryExpr.java:53-61 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSomeExpr.java:59-67 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.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. 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, `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:66` calls `getChildren`, `singletonList` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSomeExpr.java:69` 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 × 5) core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLDeleteBuilderImpl.java:96— core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLDeleteBuilderImpl.java:96-104 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLDeleteBuilderImpl.java:107-115 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:187-196 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLUpdateBuilderImpl.java:99-107 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLUpdateBuilderImpl.java:110-118 — 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. 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 × 6) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1101— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1101-1108 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1301-1308 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1334-1341 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1936-1943 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3691-3698 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4068-4075 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1101` 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 × 6) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4245— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4245-4252 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4262-4269 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4337-4344 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4407-4414 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7799-7808 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11697-11705 — there are 6 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 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4245` 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: the declarations holding them bind `x` to `SQLIfStatement.ElseIf` in one and `SQLIfStatement.Else` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11706` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4253` 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 × 6) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:217— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:217-224 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:339-346 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:528-535 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:32-39 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Left.java:33-40 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Right.java:33-40 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Left.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:217` 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 × 5) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:200— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:200-207 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:228-235 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:366-373 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:363-370 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:150-157 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `x` to `CKAlterTableUpdateStatement` in one and `DmUpdateStatement` 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 × 5) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:225— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:225-232 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:363-370 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:360-367 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:147-154 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3890-3897 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:225` 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 `x` to `DmUpdateStatement` in one and `OscarUpdateStatement` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:359` calls `isOnly`, `print0` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3888` 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 × 5) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:999— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:999-1006 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2049-2056 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5314-5321 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10234-10243 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12372-12379 — 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. 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 `x` to `MySqlShowMigrateTaskStatusStatement` in one and `SQLSavePointStatement` 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.
AC2 · Forms & labels· <fieldset> without a <legend> · ×2
<fieldset> without a <legend> core/src/main/resources/support/http/resources/login.html:55— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
<fieldset> without a <legend> druid-admin/src/main/resources/support/http/resources/login.html:53— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
Low contrast colour pair in CSS (2.2:1) druid-demo-petclinic/src/main/scss/header.scss:57— `.navbar li:hover > a` sets color: #eeeeee on background-color: #6db33f — 2.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (2.2:1) druid-demo-petclinic/src/main/resources/static/resources/css/petclinic.css:7973— `.navbar li:hover > a` sets color: #eeeeee on background-color: #6db33f — 2.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
SQLASTOutputVisitor.visit (cyclomatic 43) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2431— SQLASTOutputVisitor.visit has cyclomatic complexity 43 (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.
SQLASTOutputVisitor.visit (cyclomatic 43) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4187— SQLASTOutputVisitor.visit has cyclomatic complexity 43 (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.
SQLASTOutputVisitor.visit (cyclomatic 41) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7870— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 41) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5335— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 35) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6875— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 35) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4715— SQLASTOutputVisitor.visit 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.
OscarOutputVisitor.visit (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2280— OscarOutputVisitor.visit 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.
OscarOutputVisitor.visit (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:90— OscarOutputVisitor.visit 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.
PGOutputVisitor.visit (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2773— PGOutputVisitor.visit 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.
PGOutputVisitor.visit (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1566— PGOutputVisitor.visit 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.
SchemaStatVisitor.visit (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:650— SchemaStatVisitor.visit has cyclomatic complexity 30 (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.
SchemaStatVisitor.visit (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1213— SchemaStatVisitor.visit has cyclomatic complexity 30 (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.
SQLASTOutputVisitor.visit (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9321— SQLASTOutputVisitor.visit has cyclomatic complexity 28 (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.
SQLASTOutputVisitor.visit (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6565— SQLASTOutputVisitor.visit has cyclomatic complexity 28 (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.
MySqlOutputVisitor.visit (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3448— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1451— MySqlOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12280— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5984— SQLASTOutputVisitor.visit 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.
PGOutputVisitor.visit (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:606— PGOutputVisitor.visit 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.
PGOutputVisitor.visit (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:105— PGOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:661— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2065— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:725— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4663— MySqlOutputVisitor.visit 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.
WebStatFilter.init (cyclomatic 21) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:200— WebStatFilter.init 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.
WebStatFilter.init (cyclomatic 21) core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:199— WebStatFilter.init 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.
doT.doT.template (cyclomatic 21) REDACTED:94— doT.doT.template has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
doT.doT.template (cyclomatic 21) REDACTED:87— doT.doT.template has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WebStatFilter.doFilter (cyclomatic 20) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:65— WebStatFilter.doFilter 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.
WebStatFilter.doFilter (cyclomatic 20) core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:64— WebStatFilter.doFilter 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.
GaussDbOutputVisitor.visit (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:197— GaussDbOutputVisitor.visit 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.
GaussDbOutputVisitor.visit (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:339— GaussDbOutputVisitor.visit 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.
StatViewFilter.init (cyclomatic 19) core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:42— StatViewFilter.init 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.
StatViewFilter.init (cyclomatic 19) core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:41— StatViewFilter.init 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.
MySqlOutputVisitor.visit (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5170— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4921— MySqlOutputVisitor.visit 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.
PGOutputVisitor.visit (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:74— PGOutputVisitor.visit 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.
PGOutputVisitor.visit (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2950— PGOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4146— MySqlOutputVisitor.visit 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.
MySqlOutputVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4973— MySqlOutputVisitor.visit 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.
OracleOutputVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2132— OracleOutputVisitor.visit 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.
OracleOutputVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2382— OracleOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7978— SQLASTOutputVisitor.visit 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.
SQLASTOutputVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2280— SQLASTOutputVisitor.visit 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.
ResourceHandler.service (cyclomatic 17) REDACTED:300— ResourceHandler.service has cyclomatic complexity 17 (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.
ResourceHandler.service (cyclomatic 17) REDACTED:280— ResourceHandler.service has cyclomatic complexity 17 (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.
DruidWebUtils.getRemoteAddr (cyclomatic 17) core/src/main/java/com/alibaba/druid/util/DruidWebUtils.java:56— DruidWebUtils.getRemoteAddr 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 shape REPEATS in the file: one other method here (DruidWebUtils.getRemoteAddr) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DruidWebUtils.getRemoteAddr (cyclomatic 17) core/src/main/java/com/alibaba/druid/util/DruidWebUtils.java:23— DruidWebUtils.getRemoteAddr 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 shape REPEATS in the file: one other method here (DruidWebUtils.getRemoteAddr) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OdpsOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1253— OdpsOutputVisitor.visit 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.
OdpsOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:701— OdpsOutputVisitor.visit 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.
OracleOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2938— OracleOutputVisitor.visit 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.
OracleOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2441— OracleOutputVisitor.visit 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.
ResourceServlet.initAuthEnv (cyclomatic 16) REDACTED:68— ResourceServlet.initAuthEnv 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.
ResourceServlet.initAuthEnv (cyclomatic 16) REDACTED:55— ResourceServlet.initAuthEnv 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.
SQLASTOutputVisitor.visit (cognitive 100) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2431— SQLASTOutputVisitor.visit has cognitive complexity 100 (threshold 15). Drivers by points: if/else 27 (71 pts), ternaries 6 (15 pts), boolean chains 12, loops 1 (2 pts) (nesting depth added 54). 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.
SQLASTOutputVisitor.visit (cognitive 100) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4187— SQLASTOutputVisitor.visit has cognitive complexity 100 (threshold 15). Drivers by points: if/else 33 (68 pts), ternaries 4 (15 pts), loops 4 (9 pts), boolean chains 8 (nesting depth added 51). 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.
SQLASTOutputVisitor.visit (cognitive 56) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9321— SQLASTOutputVisitor.visit has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 14 (37 pts), if/else 14 (19 pts) (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.
SQLASTOutputVisitor.visit (cognitive 56) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9871— SQLASTOutputVisitor.visit has cognitive complexity 56 (threshold 15). Drivers by points: if/else 17 (27 pts), ternaries 8 (23 pts), boolean chains 4, loops 1 (2 pts) (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.
MySqlOutputVisitor.visit (cognitive 50) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1451— MySqlOutputVisitor.visit has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (28 pts), ternaries 6 (11 pts), loops 4 (10 pts), boolean chains 1 (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.
MySqlOutputVisitor.visit (cognitive 50) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3948— MySqlOutputVisitor.visit has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 14 (30 pts), if/else 17 (20 pts) (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.
SQLASTOutputVisitor.visit (cognitive 45) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3536— SQLASTOutputVisitor.visit has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (22 pts), ternaries 9 (20 pts), boolean chains 2, 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.
SQLASTOutputVisitor.visit (cognitive 45) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7019— SQLASTOutputVisitor.visit has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 14 (27 pts), if/else 12 (14 pts), boolean chains 2, loops 1 (2 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.
PGOutputVisitor.visit (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:606— PGOutputVisitor.visit has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 6 (16 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.
PGOutputVisitor.visit (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1566— PGOutputVisitor.visit has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 11 (23 pts), if/else 17 (20 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 37) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8138— SQLASTOutputVisitor.visit has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 4 (13 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 18). 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.
SQLASTOutputVisitor.visit (cognitive 37) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5588— SQLASTOutputVisitor.visit has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 11 (20 pts), if/else 11 (13 pts), boolean chains 2, 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.
MySqlOutputVisitor.visit (cognitive 35) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4040— MySqlOutputVisitor.visit has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 9 (24 pts), if/else 5 (8 pts), match/switch 1 (2 pts), loops 1 (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.
MySqlOutputVisitor.visit (cognitive 35) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5024— MySqlOutputVisitor.visit has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 9 (16 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.
SQLASTOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12280— SQLASTOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 10 (20 pts), if/else 10, boolean chains 4 (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.
SQLASTOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5051— SQLASTOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 11 (21 pts), if/else 11, loops 1 (2 pts) (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.
SQLASTOutputVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6190— SQLASTOutputVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 10 (14 pts), boolean chains 2, loops 1 (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.
SQLASTOutputVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6259— SQLASTOutputVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 12 (23 pts), if/else 9 (10 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.
MySqlOutputVisitor.visit (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1986— MySqlOutputVisitor.visit has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 7 (19 pts), if/else 7 (11 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.
MySqlOutputVisitor.visit (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5414— MySqlOutputVisitor.visit has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 8 (10 pts), loops 1 (2 pts) (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.
WebStatFilter.init (cognitive 28) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:200— WebStatFilter.init has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 6). 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.
WebStatFilter.init (cognitive 28) core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:199— WebStatFilter.init has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 6). 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.
MySqlOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4146— MySqlOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 3 (6 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.
MySqlOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1716— MySqlOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 8 (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.
SQLASTOutputVisitor.visit (cognitive 26) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10836— SQLASTOutputVisitor.visit has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 7 (12 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.
SQLASTOutputVisitor.visit (cognitive 26) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2058— SQLASTOutputVisitor.visit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 5 (9 pts), 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.
OracleOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2938— OracleOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (10 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.
OracleOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2382— OracleOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 7 (12 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.
PGOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1687— PGOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 7 (12 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.
PGOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2950— PGOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 8 (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.
WebStatFilter.doFilter (cognitive 25) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:65— WebStatFilter.doFilter has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (21 pts), error handling 4 (nesting depth added 5). 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.
WebStatFilter.doFilter (cognitive 25) core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:64— WebStatFilter.doFilter has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (21 pts), error handling 4 (nesting depth added 5). 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.
OscarOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:201— OscarOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 7 (9 pts) (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.
OscarOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1986— OscarOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 3 (8 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.
PGOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:181— PGOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 7 (9 pts) (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.
PGOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2479— PGOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 3 (8 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.
SQLASTOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5879— SQLASTOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 7 (9 pts) (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.
SQLASTOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11062— SQLASTOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 8 (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.
StatViewFilter.init (cognitive 24) core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:42— StatViewFilter.init has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 2 (4 pts), error handling 2 (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.
StatViewFilter.init (cognitive 24) core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:41— StatViewFilter.init has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 2 (4 pts), error handling 2 (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.
MySqlOutputVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3810— MySqlOutputVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 6 (7 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.
MySqlOutputVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4973— MySqlOutputVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 7 (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.
AbstractWebStatImpl.getSessionId (cognitive 23) core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:137— AbstractWebStatImpl.getSessionId has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (7 pts) (nesting depth added 15). 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.
AbstractWebStatImpl.getSessionId (cognitive 23) core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java:136— AbstractWebStatImpl.getSessionId has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (7 pts) (nesting depth added 15). 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.
SQLASTOutputVisitor.visit (cognitive 21) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7178— SQLASTOutputVisitor.visit has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 7, loops 1 (2 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.
SQLASTOutputVisitor.visit (cognitive 21) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4974— SQLASTOutputVisitor.visit has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 6 (9 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.
ResourceServlet.initAuthEnv (cognitive 21) REDACTED:68— ResourceServlet.initAuthEnv has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 2 (4 pts), error handling 2 (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.
ResourceServlet.initAuthEnv (cognitive 21) REDACTED:55— ResourceServlet.initAuthEnv has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 2 (4 pts), error handling 2 (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.
ResourceHandler.service (cognitive 21) REDACTED:300— ResourceHandler.service has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6 (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.
ResourceHandler.service (cognitive 21) REDACTED:280— ResourceHandler.service has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6 (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.
template (cognitive 21) REDACTED:94— template has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, ternaries 6, if/else 3 (4 pts), error handling 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
template (cognitive 21) REDACTED:87— template has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, ternaries 6, if/else 3 (4 pts), error handling 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SchemaResolveVisitorFactory.resolve (cognitive 20) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1731— SchemaResolveVisitorFactory.resolve has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (2 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.
SchemaResolveVisitorFactory.resolve (cognitive 20) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:872— SchemaResolveVisitorFactory.resolve has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3 (5 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.
resolveDefs (cognitive 20) REDACTED:58— resolveDefs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, ternaries 2 (nesting depth added 6). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 60, 77, 76, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
resolveDefs (cognitive 20) REDACTED:51— resolveDefs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, ternaries 2 (nesting depth added 6). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 53, 70, 69, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MySqlOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2327— MySqlOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 5, boolean chains 2 (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.
MySqlOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4560— MySqlOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (9 pts), 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.
OscarOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:592— OscarOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 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.
OscarOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:63— OscarOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6 (8 pts), loops 1 (2 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.
DruidWebUtils.getRemoteAddr (cognitive 19) core/src/main/java/com/alibaba/druid/util/DruidWebUtils.java:56— DruidWebUtils.getRemoteAddr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8 (nesting depth added 3). 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. This shape REPEATS in the file: one other method here (DruidWebUtils.getRemoteAddr) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DruidWebUtils.getRemoteAddr (cognitive 19) core/src/main/java/com/alibaba/druid/util/DruidWebUtils.java:23— DruidWebUtils.getRemoteAddr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8 (nesting depth added 3). 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. This shape REPEATS in the file: one other method here (DruidWebUtils.getRemoteAddr) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SQLMethodInvokeExpr.accept0 (cognitive 18) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:280— SQLMethodInvokeExpr.accept0 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 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. This shape REPEATS in the file: one other method here (SQLMethodInvokeExpr.accept0) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SQLMethodInvokeExpr.accept0 (cognitive 18) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:235— SQLMethodInvokeExpr.accept0 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 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. This shape REPEATS in the file: one other method here (SQLMethodInvokeExpr.accept0) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OscarOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1918— OscarOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (7 pts), loops 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.
OscarOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:350— OscarOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (7 pts), loops 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.
PGOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2411— PGOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (7 pts), loops 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.
PGOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:347— PGOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (7 pts), loops 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.
SchemaResolveVisitorFactory.resolve (cognitive 18) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:935— SchemaResolveVisitorFactory.resolve has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3 (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.
SchemaResolveVisitorFactory.resolve (cognitive 18) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2325— SchemaResolveVisitorFactory.resolve has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (7 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.
HiveOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:452— HiveOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 1 (3 pts), loops 1 (2 pts), ternaries 1 (2 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.
HiveOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:122— HiveOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (6 pts), 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.
MySqlOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:490— MySqlOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 5 (6 pts), loops 1 (2 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.
MySqlOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4592— MySqlOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 5 (7 pts), 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.
OscarOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1449— OscarOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5, boolean chains 1, loops 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.
OscarOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:228— OscarOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 6 (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.
PGOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2894— PGOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2 (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.
PGOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1826— PGOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5, boolean chains 1, loops 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.
AbstractWebStatImpl.getPrincipal (cognitive 17) core/src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java:167— AbstractWebStatImpl.getPrincipal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (2 pts), loops 1 (2 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.
AbstractWebStatImpl.getPrincipal (cognitive 17) core/src/main/java/com/alibaba/druid/support/jakarta/AbstractWebStatImpl.java:166— AbstractWebStatImpl.getPrincipal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (2 pts), loops 1 (2 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.
Near-duplicate member pair (38 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:23— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:23-76 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:64-124 — 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.
Near-duplicate member pair (38 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:91— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:91-564 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9231-9396 — 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· Edited copy of a member (74 corresponding lines) · ×2
Edited copy of a member (74 corresponding lines) core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:24— core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:24-117 | core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java:41-132 — These two members are one piece of code written twice and then edited apart: 74 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 (74 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:280— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:280-357 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2058-2131 — These two members are one piece of code written twice and then edited apart: 74 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) · ×2
Edited copy of a member (44 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:764— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:764-807 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1144-1187 — 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.
Edited copy of a member (44 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:239— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:239-285 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7229-7272 — 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· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (9 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:178— core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:178-197 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:201-220 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:224-243 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:247-266 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:292-314 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:317-336 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:340-359 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:363-382 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:386-405 — These 9 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 9 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 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1830— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1830-1846 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1849-1865 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1881-1897 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1776-1792 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1795-1811 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1814-1830 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2166-2182 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2185-2201 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2204-2220 — These 9 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 9 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 9 times.
D4 · Code Duplication· Edited copy of a member (78 corresponding lines) · ×2
Edited copy of a member (78 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:813— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:813-893 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:924-1001 — These two members are one piece of code written twice and then edited apart: 78 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 (78 corresponding lines) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:213— core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:213-290 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:292-370 — These two members are one piece of code written twice and then edited apart: 78 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) · ×2
Edited copy of a member (46 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:452— core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:452-500 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringMethodStat.java:88-133 — 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.
Edited copy of a member (46 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:97— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:97-142 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1747-1797 — 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 (49 corresponding lines) · ×2
Edited copy of a member (49 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:304— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:304-352 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:6340-6401 — 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.
Edited copy of a member (49 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4921— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4921-4970 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5170-5218 — 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 (41 corresponding lines) · ×2
Edited copy of a member (41 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lpad.java:29— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lpad.java:29-71 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Rpad.java:33-73 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:136— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:136-176 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4551-4595 — 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 (36 corresponding lines) · ×2
Edited copy of a member (36 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1211— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1211-1246 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:125-160 — These two members are one piece of code written twice and then edited apart: 36 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 (36 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5263— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5263-5298 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5308-5347 — These two members are one piece of code written twice and then edited apart: 36 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, 35+ corresponding lines) · ×2
Edited copies of one member (3 members, 35+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:965— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:965-999 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1087-1121 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1467-1501 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 35 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, 35+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1490— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1490-1524 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2243-2277 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2736-2770 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 35 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 (38 corresponding lines) · ×2
Edited copy of a member (38 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:222— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:222-259 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:138-182 — 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.
Edited copy of a member (38 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2816— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2816-2853 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3166-3206 — 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 copies of one member (3 members, 22+ corresponding lines) · ×2
Edited copies of one member (3 members, 22+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:27— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Instr.java:27-48 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Left.java:28-54 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Right.java:28-53 — 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.
Edited copies of one member (3 members, 22+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1028— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1028-1049 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1150-1171 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1530-1551 — 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, 19+ corresponding lines) · ×2
Edited copies of one member (3 members, 19+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2505— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2505-2523 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2631-2650 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2878-2897 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 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, 19+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLMergeStatement.java:251— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLMergeStatement.java:251-269 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnnestTableSource.java:110-130 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLValuesTableSource.java:120-138 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 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, 15+ corresponding lines) · ×2
Edited copies of one member (3 members, 15+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3529— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3529-3550 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3686-3702 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3705-3719 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCastExpr.java:99— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCastExpr.java:99-116 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectItem.java:95-118 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleIsOfTypeExpr.java:33-47 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 20+ corresponding lines) · ×2
Edited copies of one member (4 members, 20+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:76— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:76-95 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:97-116 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:118-137 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:139-158 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 20+ corresponding lines) core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:269— core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:269-288 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:430-451 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:455-478 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:482-501 — These 4 members are one piece of code written 4 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 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1473— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1473-1487 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2226-2240 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2719-2733 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:591-606 — 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) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1736— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1736-1754 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLDeleteBuilderImpl.java:41-55 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:39-53 | core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLUpdateBuilderImpl.java:44-58 — 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 (4 members, 8+ corresponding lines) · ×2
Edited copies of one member (4 members, 8+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowColumnsStatement.java:80— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowColumnsStatement.java:80-88 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowDatabasesStatement.java:69-76 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowEventsStatement.java:50-57 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowTableStatusStatement.java:55-63 — 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.
Edited copies of one member (4 members, 8+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/ast/HiveInsertStatement.java:40— core/src/main/java/com/alibaba/druid/sql/dialect/hive/ast/HiveInsertStatement.java:40-49 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/ast/HiveMultiInsertStatement.java:72-79 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarDeleteStatement.java:59-68 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGDeleteStatement.java:75-85 — 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 copy of a member (6 corresponding lines) · ×2
Edited copy of a member (6 corresponding lines) core/src/main/java/com/alibaba/druid/proxy/jdbc/WrapperProxyImpl.java:101— core/src/main/java/com/alibaba/druid/proxy/jdbc/WrapperProxyImpl.java:101-106 | core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:153-159 — 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2559— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2559-2564 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10192-10197 — 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.
Duplicated block (110 lines × 2) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:67— core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:67-176 | core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:66-175 — `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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: `HttpServletRequest` names `jakarta.servlet.http.HttpServletRequest` in one and `javax.servlet.http.HttpServletRequest` 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 (110 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlEvalVisitorImpl.java:36— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlEvalVisitorImpl.java:36-154 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorImpl.java:35-144 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlEvalVisitorImpl.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorImpl.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. 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 (78 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:214— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:214-291 | core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java:95-172 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 94 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 (78 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:147— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:147-224 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:154-231 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:147` 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 (71 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8755— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8755-8825 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8864-8934 — 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 `x` to `SQLCreateSequenceStatement` in one and `SQLAlterSequenceStatement` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8752` calls `print0`, `getName`, `accept` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8862` 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 (71 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/SQLAlterResourceGroupStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/SQLAlterResourceGroupStatement.java:1-72 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/SQLCreateResourceGroupStatement.java:1-71 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/SQLAlterResourceGroupStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/SQLCreateResourceGroupStatement.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. 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/SQLAlterResourceGroupStatement.java:1` 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 (66 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5598— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5598-5663 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5681-5746 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5598` 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 (66 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:100— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:100-165 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:104-169 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 217 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:100` 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 (56 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:64— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:64-119 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:232-287 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 247 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 (56 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAddStatisticStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAddStatisticStatement.java:1-57 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsRemoveStatisticStatement.java:1-56 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAddStatisticStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsRemoveStatisticStatement.java` as WHOLE FILES: 92% 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAddStatisticStatement.java:1` 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 (55 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:287— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:287-341 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:482-536 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 294 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:287` 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 (55 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/ast/BigQueryModelExpr.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/ast/BigQueryModelExpr.java:1-55 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/ast/BigQueryTableExpr.java:1-55 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/ast/BigQueryModelExpr.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/ast/BigQueryTableExpr.java` as WHOLE FILES: 97% 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/ast/BigQueryModelExpr.java:1` 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 (48 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4262— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4262-4309 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4335-4382 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4384` calls `identifierEquals`, `nextToken` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4311` 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 (48 lines × 2) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:212— core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:212-259 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:471-518 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/stat/DruidStatService.java` and `druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 108 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 (45 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:562— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:562-606 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1919-1963 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2412-2456 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (45 lines × 3) core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorApp.java:1— core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorApp.java:1-45 | core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorCluster.java:1-54 | core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorInstance.java:1-92 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorApp.java` and `core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorCluster.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. 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 `core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorApp.java:1` 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 (41 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:642— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:642-682 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1180-1220 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:642` 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 (41 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlLockTableStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlLockTableStatement.java:1-106 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSessionStatement.java:1-41 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlLockTableStatement.java:1` 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 (40 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:294— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:294-333 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:299-338 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `x` to `OscarInsertStatement` in one and `PGInsertStatement` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:298` calls `printOnConflict` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:292` 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 (40 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsCopyStmt.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsCopyStmt.java:1-40 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsPAIStmt.java:1-40 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsCopyStmt.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsPAIStmt.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. 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsCopyStmt.java:1` 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 (36 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:927— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:927-962 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1049-1084 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1429-1464 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (36 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2521— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2521-2556 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1451-1486 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1828-1863 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2521` 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 (32 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:41— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:41-72 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:64-95 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:66-97 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:41` 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 (32 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2668— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2668-2699 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1588-1619 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1965-1996 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2668` 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 (29 lines × 3) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:231— core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:231-259 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:293-321 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:345-373 — 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 (29 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:189— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:189-217 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:423-451 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:921-949 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 (28 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:682— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:682-709 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2079-2106 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2572-2599 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (28 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1491— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1491-1518 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2244-2271 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2737-2764 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1491` 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 (27 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:138— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:138-164 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:596-622 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5795-5821 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java` as WHOLE FILES: this scan already matched 6 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:138` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:497— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:497-523 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:765-791 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1145-1171 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (24–26 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:74— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:74-97 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:125-150 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.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. 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 (24–26 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4404— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4404-4429 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7643-7666 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4404` 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 × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5353— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5353-5376 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5421-5444 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5465-5488 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5353` 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 (24 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2714— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2714-2737 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1626-1649 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2003-2026 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2714` 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 (23 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:398— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:398-420 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:157-179 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:525-547 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1836-1858 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1957-1979 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 176 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:398` 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 (23 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:454— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:454-476 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:254-276 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:620-642 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1878-1900 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2002-2024 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 176 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:454` 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 (23 lines × 4) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1021— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1021-1043 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1095-1117 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1177-1199 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1275-1297 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1021` 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 (23 lines × 4) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1045— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1045-1067 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1119-1141 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1201-1223 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1291-1313 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1045` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLUnionQueryTableSource` in one and `SQLSubqueryTableSource` 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 (22 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:991— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:991-1012 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:1068-1089 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2456-2477 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2520-2541 — 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.
Duplicated block (22 lines × 4) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2862— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2862-2883 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2912-2933 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2937-2958 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2962-2983 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2862` 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 (21 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:240— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:240-260 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:285-305 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsNewExpr.java:36-56 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `visitor` to `SQLASTVisitor` in one and `OracleASTVisitor` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:238` calls `acceptChild` and `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsNewExpr.java:35` 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 (21 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:127— core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:127-147 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:104-124 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1581-1601 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 95 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 (20 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:482— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:482-501 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:516-535 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:550-569 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:482` 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 (20 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1337— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1337-1356 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1360-1379 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1383-1402 — 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. 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–20 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:254— core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:254-273 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3539-3556 — 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 (18–20 lines × 2) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1689— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1689-1706 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1709-1728 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1709` 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 (17–19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:130— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:130-146 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:178-196 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:130` 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–19 lines × 2) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1640— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1640-1658 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1662-1678 — 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–19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:190— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:190-208 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:361-378 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:361` 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.
Duplicated block (18–19 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1785— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1785-1802 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1833-1851 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1785` 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.
Duplicated block (15–17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4674— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4674-4690 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6762-6776 — 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 `x` to `SQLCreateProcedureStatement` in one and `SQLDropFunctionStatement` 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 (15–17 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeLexer.java:186— core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeLexer.java:186-202 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2379-2393 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeLexer.java:186` 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 × 6) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:675— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:675-690 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:709-724 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:745-760 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:767-782 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:791-806 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:815-830 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:675` 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 (16 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1066— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1066-1081 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1092-1107 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1117-1132 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1142-1157 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1167-1182 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1192-1207 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1066` 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 (15–16 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:484— core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:484-498 | core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:504-519 — 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 (15–16 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5207— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5207-5221 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5280-5295 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5207` 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 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 (15 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:243— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:243-257 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:409-423 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:168-182 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:536-550 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1847-1861 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1968-1982 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 176 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:243` 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 × 6) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6073— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6073-6087 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6310-6324 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6394-6408 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6605-6619 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6682-6696 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6848-6862 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6073` 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, `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6308` calls `add` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6604` 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 (14–15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:173— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:173-187 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:242-255 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:475-488 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:173` 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 (14–15 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:146— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:146-160 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:206-219 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:210-223 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 89 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java: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. 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.
Duplicated block (13–14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:403— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:403-415 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:330-342 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2379-2392 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `stmt` to `HiveCreateTableStatement` in one and `SQLAlterTableStatement` 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 (13–14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:121— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:121-133 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:566-579 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:230-243 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java` as WHOLE FILES: this scan already matched 6 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:121` 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 × 9) core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:186— core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:186-197 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:209-220 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:232-243 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:255-266 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:303-314 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:325-336 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:348-359 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:371-382 | core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:394-405 — 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 `core/src/main/java/com/alibaba/druid/filter/FilterEventAdapter.java:186` 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 × 9) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterSequenceStatement.java:161— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterSequenceStatement.java:161-172 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableStatement.java:237-248 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterViewStatement.java:76-87 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateFunctionStatement.java:232-243 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateSequenceStatement.java:172-183 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:180-191 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateViewStatement.java:92-103 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropSequenceStatement.java:70-81 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropSynonymStatement.java:72-83 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterSequenceStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateSequenceStatement.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 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 (11–12 lines × 3) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:119— core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:119-129 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:188-199 | core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:451-461 — 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 `core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:119` 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 first that the copies are not typed on the same thing: the declarations holding them bind `queryBlock` to `SQLUnionQuery` in one and `SQLSelectQueryBlock` 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, `core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:130` calls `getRowCount` and `core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:201` 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–12 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:54— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:54-64 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:57-68 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:107-117 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:57` 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.
Duplicated block (11 lines × 8) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:109— core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:109-119 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:563-573 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:651-661 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:910-920 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3223-3233 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3407-3417 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3471-3481 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6736-6746 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLCreateTableStatement` in one and `OdpsReadStatement` 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 (11 lines × 8) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Bin.java:28— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Bin.java:28-38 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/BitLength.java:28-38 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:31-41 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Length.java:31-41 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ltrim.java:28-38 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Reverse.java:28-38 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Trim.java:28-38 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ucase.java:31-41 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Bin.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/functions/BitLength.java` as WHOLE FILES: 84% 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. 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 (11 lines × 5) core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:72— core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:72-82 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:96-106 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:118-128 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:142-152 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:166-176 — 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 `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:72` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:141` calls `findColumn` and `core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.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 (11 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:409— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:409-419 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1510-1520 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2263-2273 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2756-2766 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7735-7745 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:421` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7746` 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–11 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:632— core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:632-642 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:652-660 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:632` 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–11 lines × 2) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1851— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1851-1859 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1860-1870 — 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 (10 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:940— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:940-949 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:987-996 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1062-1071 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1109-1118 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1442-1451 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1489-1498 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `x` to `OracleInsertStatement` in one and `InsertIntoClause` 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 (10 lines × 6) core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:832— core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:832-841 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:850-859 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:866-875 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:883-892 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:901-910 | core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:917-926 — 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 `core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:832` 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 (10 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:107— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:107-116 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:237-246 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:375-384 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:372-381 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:165-174 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `DmSelectQueryBlock` in one and `DmUpdateStatement` 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 (10 lines × 5) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLGroupingSetExpr.java:123— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLGroupingSetExpr.java:123-132 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLListExpr.java:114-123 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropUserStatement.java:80-90 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLInsertInto.java:82-92 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLInsertStatement.java:102-112 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropUserStatement.java:76` calls `getChildren` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLGroupingSetExpr.java:122` 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–10 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:85— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:85-93 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:60-69 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:107-116 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:109-118 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:85` 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–10 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:226— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:226-235 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1874-1883 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2664-2672 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2701-2710 — there are 4 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 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:226` 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–9 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1443— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1443-1451 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerExprParser.java:111-116 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1443` 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–9 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1459— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1459-1467 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerExprParser.java:110-115 — 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 × 11) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6122— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6122-6129 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6141-6148 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6160-6167 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6201-6208 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6423-6430 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6441-6448 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6458-6465 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6733-6740 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6752-6759 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6771-6778 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6817-6824 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6122` 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, `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6130` calls `SQLIntegerExpr` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6741` 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 × 11) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2458— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2458-2465 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5253-5261 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5264-5272 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5478-5486 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6174-6181 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6472-6479 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6486-6494 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6801-6811 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9273-9280 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11193-11200 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11203-11210 — there are 11 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 11 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 `x` to `MySqlShowCreateDatabaseStatement` in one and `SQLDropServerStatement` 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–7 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:70— core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:70-75 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3610-3616 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarPermissionOutputVisitor.java:65-71 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3178-3183 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 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 `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `DorisExprTableSource` in one and `SQLExprTableSource` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:75` calls `print0`, `isNeedAsTokenForAlias` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3616` 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 (6–7 lines × 4) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1641— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1641-1647 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1663-1669 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1682-1688 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1698-1703 — 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 `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1641` 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 (4–7 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:43— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:43-49 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:65-71 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:75-78 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 111 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:43` 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. Note first that the copies are not typed on the same thing: `ForClause` names `com.alibaba.druid.sql.dialect.dm.ast.stmt.DmSelectQueryBlock.ForClause` in one and `com.alibaba.druid.sql.dialect.oscar.ast.stmt.OscarSelectQueryBlock.ForClause` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:43` calls `equals`, `getOption` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:75` does not — after which the two agree again for 5 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 (4–7 lines × 3) core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:427— core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:427-430 | core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:494-500 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringMethodStat.java:127-133 — 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 `core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:494` 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.
Duplicated block (6–7 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:224— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:224-230 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1408-1413 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java` as WHOLE FILES: this scan already matched 6 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:224` 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–7 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:210— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:210-215 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5927-5933 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5927` 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 (21 lines × 7) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterDatabaseStatement.java:37— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterDatabaseStatement.java:37-97 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableCompression.java:25-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableGroupStatement.java:31-59 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTypeStatement.java:1-87 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropProcedureStatement.java:27-64 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLPurgeTemporaryOutputStatement.java:26-50 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlCreateFullTextAnalyzerStatement.java:1-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 times. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTypeStatement.java:1` 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 (21 lines × 7) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7-75 | core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKASTVisitor.java:13-60 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveASTVisitor.java:29-83 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitorAdapter.java:1-229 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/visitor/PrestoASTVisitor.java:14-66 | core/src/main/java/com/alibaba/druid/sql/dialect/redshift/visitor/RedshiftASTVisitor.java:7-27 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/visitor/SQLiteASTVisitor.java:7-40 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveASTVisitor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 687 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7` 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: the declarations holding them bind `x` to `BigQuerySelectQueryBlock` in one and `CKCreateTableStatement` 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 (39 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropClusteringKey.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropClusteringKey.java:1-39 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropKey.java:1-39 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropClusteringKey.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropKey.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. 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropClusteringKey.java:1` 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 (39 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropForeignKey.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropForeignKey.java:1-39 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropIndex.java:1-39 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropForeignKey.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropIndex.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. 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropForeignKey.java:1` 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 (30 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlObjectImpl.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlObjectImpl.java:1-30 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableDiscardTablespace.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableImportTablespace.java:1-37 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableDiscardTablespace.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlAlterTableImportTablespace.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 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. 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlObjectImpl.java:1` 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 (30 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAddTableStatement.java:39— core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAddTableStatement.java:39-103 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsCountStatement.java:34-63 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsRestoreStatement.java:38-90 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsAddTableStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsCountStatement.java` as WHOLE FILES: 84% 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. 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.
Unfinished stub — throws a "not implemented" exception core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4256— `parseCreateScan` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7980— `parseClone` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Complex function template (cyclomatic 16, cognitive 16) REDACTED:94— template has cyclomatic complexity 16 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function template (cyclomatic 16, cognitive 16) REDACTED:87— template has cyclomatic complexity 16 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
AC3 · Page structure· Heading level jumps from h3 to h5 · ×1
Heading level jumps from h3 to h5 core/src/main/resources/support/http/resources/sql-detail.html:21— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
Empty <h5> heading core/src/main/resources/support/http/resources/sql-detail.html:21— An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
MySqlStatementParser.parseShow (cyclomatic 275) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2497— MySqlStatementParser.parseShow has cyclomatic complexity 275 (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.
SQLExprParser.primary (cyclomatic 202) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:464— SQLExprParser.primary has cyclomatic complexity 202 (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.
SQLSelectParser.parseTableSourceRest (cyclomatic 161) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1601— SQLSelectParser.parseTableSourceRest has cyclomatic complexity 161 (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.
OdpsCreateTableParser.parseCreateTable (cyclomatic 152) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:39— OdpsCreateTableParser.parseCreateTable has cyclomatic complexity 152 (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.
MySqlStatementParser.parseStatementListDialect (cyclomatic 149) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1046— MySqlStatementParser.parseStatementListDialect has cyclomatic complexity 149 (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.
SQLParser.alias (cyclomatic 142) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:671— SQLParser.alias has cyclomatic complexity 142 (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.
Lexer.scanSQLType (cyclomatic 138) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:696— Lexer.scanSQLType has cyclomatic complexity 138 (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.
SQLExprParser.name (cyclomatic 138) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2308— SQLExprParser.name has cyclomatic complexity 138 (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.
MySqlCreateTableParser.parseCreateTable (cyclomatic 114) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:91— MySqlCreateTableParser.parseCreateTable has cyclomatic complexity 114 (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.
MySqlStatementParser.parseAlterSpecification (cyclomatic 114) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5783— MySqlStatementParser.parseAlterSpecification has cyclomatic complexity 114 (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.
OracleStatementParser.parseStatementList (cyclomatic 113) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:69— OracleStatementParser.parseStatementList has cyclomatic complexity 113 (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.
OdpsStatementParser.parseStatementListDialect (cyclomatic 104) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:84— OdpsStatementParser.parseStatementListDialect has cyclomatic complexity 104 (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.
SQLTimestampExpr.check (cyclomatic 100) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:256— SQLTimestampExpr.check has cyclomatic complexity 100 (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.
MySqlUtils.parseDateTime (cyclomatic 98) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1436— MySqlUtils.parseDateTime has cyclomatic complexity 98 (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.
SQLParser.as (cyclomatic 97) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:478— SQLParser.as has cyclomatic complexity 97 (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.
Lexer.nextToken (cyclomatic 94) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1252— Lexer.nextToken has cyclomatic complexity 94 (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.
MySqlUtils.parseDate (cyclomatic 93) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:978— MySqlUtils.parseDate has cyclomatic complexity 93 (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.
SQLEvalVisitorUtils.visit (cyclomatic 92) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:184— SQLEvalVisitorUtils.visit has cyclomatic complexity 92 (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.
SQLExprParser.parseSelectItem (cyclomatic 90) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5859— SQLExprParser.parseSelectItem has cyclomatic complexity 90 (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.
WebAppStat.computeUserAgent (cyclomatic 90) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:524— WebAppStat.computeUserAgent has cyclomatic complexity 90 (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.
MySqlExprParser.primary (cyclomatic 89) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:915— MySqlExprParser.primary has cyclomatic complexity 89 (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.
SQLExprParser.relationalRest (cyclomatic 86) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3742— SQLExprParser.relationalRest has cyclomatic complexity 86 (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.
SQLParser.tableAliasFromOptionalKeyword (cyclomatic 83) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:230— SQLParser.tableAliasFromOptionalKeyword has cyclomatic complexity 83 (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.
SQLStatementParser.parsePrivilege (cyclomatic 79) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1709— SQLStatementParser.parsePrivilege has cyclomatic complexity 79 (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.
SQLStatementParser.parseStatementList (cyclomatic 79) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:131— SQLStatementParser.parseStatementList has cyclomatic complexity 79 (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.
SQLStatementParser.parseValueClauseNative (cyclomatic 79) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6057— SQLStatementParser.parseValueClauseNative has cyclomatic complexity 79 (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.
JdbcUtils.getDbTypeRaw (cyclomatic 78) core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:562— JdbcUtils.getDbTypeRaw has cyclomatic complexity 78 (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.
MySqlStatementParser.parseInsert (cyclomatic 73) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4535— MySqlStatementParser.parseInsert has cyclomatic complexity 73 (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.
JdbcUtils.getDriverClassName (cyclomatic 73) core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:395— JdbcUtils.getDriverClassName has cyclomatic complexity 73 (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.
MySqlCreateTableParser.parseOptions (cyclomatic 71) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:628— MySqlCreateTableParser.parseOptions has cyclomatic complexity 71 (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.
SQLEvalVisitorUtils.visit (cyclomatic 70) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:958— SQLEvalVisitorUtils.visit has cyclomatic complexity 70 (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.
SQLDataTypeImpl.jdbcType (cyclomatic 69) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:178— SQLDataTypeImpl.jdbcType has cyclomatic complexity 69 (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.
OracleCreateTableParser.parseCreateTable (cyclomatic 67) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:48— OracleCreateTableParser.parseCreateTable has cyclomatic complexity 67 (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.
SQLStatementParser.parseValueClause (cyclomatic 67) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6662— SQLStatementParser.parseValueClause has cyclomatic complexity 67 (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.
MySqlExprParser.parseSelectItemRest (cyclomatic 66) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:564— MySqlExprParser.parseSelectItemRest has cyclomatic complexity 66 (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.
SQLASTOutputVisitor.visit (cyclomatic 66) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10478— SQLASTOutputVisitor.visit has cyclomatic complexity 66 (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.
MySqlOutputVisitor.visit (cyclomatic 65) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:259— MySqlOutputVisitor.visit has cyclomatic complexity 65 (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.
SchemaResolveVisitorFactory.resolveIdent (cyclomatic 65) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1029— SchemaResolveVisitorFactory.resolveIdent has cyclomatic complexity 65 (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.
SQLStatementParser.parseValueClause (cyclomatic 64) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6388— SQLStatementParser.parseValueClause has cyclomatic complexity 64 (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.
OracleExprParser.primary (cyclomatic 63) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:305— OracleExprParser.primary has cyclomatic complexity 63 (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.
OceanBaseOracleExceptionSorter.isExceptionFatal (cyclomatic 61) core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:24— OceanBaseOracleExceptionSorter.isExceptionFatal has cyclomatic complexity 61 (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.
MySqlLexer.scanComment (cyclomatic 61) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:726— MySqlLexer.scanComment has cyclomatic complexity 61 (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.
OdpsExprParser.primaryRest (cyclomatic 61) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:537— OdpsExprParser.primaryRest has cyclomatic complexity 61 (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.
SQLExprParser.methodRest (cyclomatic 60) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1771— SQLExprParser.methodRest has cyclomatic complexity 60 (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.
SQLASTOutputVisitor.visit (cyclomatic 59) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1522— SQLASTOutputVisitor.visit has cyclomatic complexity 59 (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.
OracleExceptionSorter.isExceptionFatal (cyclomatic 57) core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java:41— OracleExceptionSorter.isExceptionFatal has cyclomatic complexity 57 (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.
HiveStatementParser.parseStatementListDialect (cyclomatic 56) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:121— HiveStatementParser.parseStatementListDialect has cyclomatic complexity 56 (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.
CalciteMySqlNodeVisitor.visit (cyclomatic 56) core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java:1008— CalciteMySqlNodeVisitor.visit has cyclomatic complexity 56 (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.
MySqlOutputVisitor.visit (cyclomatic 54) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:94— MySqlOutputVisitor.visit 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.
Lexer.scanOperator (cyclomatic 54) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1527— Lexer.scanOperator 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.
SQLSelectParser.queryRest (cyclomatic 54) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:153— SQLSelectParser.queryRest 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.
Lexer.scanNumber (cyclomatic 52) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2852— Lexer.scanNumber has cyclomatic complexity 52 (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.
SQLParserUtils.splitAndRemoveComment (cyclomatic 52) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:802— SQLParserUtils.splitAndRemoveComment has cyclomatic complexity 52 (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.
OdpsStatementParser.parseShow (cyclomatic 51) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:961— OdpsStatementParser.parseShow 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.
DruidDataSourceFactory.config (cyclomatic 50) core/src/main/java/com/alibaba/druid/pool/DruidDataSourceFactory.java:179— DruidDataSourceFactory.config has cyclomatic complexity 50 (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.
MySqlOutputVisitor.visit (cyclomatic 50) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1103— MySqlOutputVisitor.visit has cyclomatic complexity 50 (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.
SchemaResolveVisitorFactory.resolve (cyclomatic 50) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1401— SchemaResolveVisitorFactory.resolve has cyclomatic complexity 50 (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.
SQLASTOutputVisitor.visit (cyclomatic 50) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9386— SQLASTOutputVisitor.visit has cyclomatic complexity 50 (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.
MySqlOutputVisitor.visit (cyclomatic 49) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:521— MySqlOutputVisitor.visit has cyclomatic complexity 49 (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.
OracleStatementParser.parserParameters (cyclomatic 49) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2005— OracleStatementParser.parserParameters has cyclomatic complexity 49 (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.
SQLASTOutputVisitor.visit (cyclomatic 49) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8737— SQLASTOutputVisitor.visit has cyclomatic complexity 49 (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.
DruidDataSource.init (cyclomatic 48) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:659— DruidDataSource.init has cyclomatic complexity 48 (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.
MySqlStatementParser.parseCreateDatabase (cyclomatic 48) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7813— MySqlStatementParser.parseCreateDatabase has cyclomatic complexity 48 (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.
OdpsSelectParser.query (cyclomatic 48) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:45— OdpsSelectParser.query has cyclomatic complexity 48 (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.
OracleExprParser.primaryRest (cyclomatic 48) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:535— OracleExprParser.primaryRest has cyclomatic complexity 48 (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.
SQLExprParser.parseDataType (cyclomatic 48) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4296— SQLExprParser.parseDataType has cyclomatic complexity 48 (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.
TDDLHint.<init> (cyclomatic 47) core/src/main/java/com/alibaba/druid/sql/ast/TDDLHint.java:24— TDDLHint.<init> has cyclomatic complexity 47 (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.
HiveCreateTableParser.parseCreateTableRest (cyclomatic 47) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:127— HiveCreateTableParser.parseCreateTableRest has cyclomatic complexity 47 (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.
MySqlSelectParser.query (cyclomatic 47) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:94— MySqlSelectParser.query has cyclomatic complexity 47 (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.
SQLASTOutputVisitor.visitInternal (cyclomatic 47) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:703— SQLASTOutputVisitor.visitInternal has cyclomatic complexity 47 (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.
SQLExprParser.parseColumnRest (cyclomatic 46) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4855— SQLExprParser.parseColumnRest has cyclomatic complexity 46 (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.
SQLASTOutputVisitor.visit (cyclomatic 46) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8848— SQLASTOutputVisitor.visit has cyclomatic complexity 46 (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.
MySqlOutputVisitor.visit (cyclomatic 45) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4794— MySqlOutputVisitor.visit has cyclomatic complexity 45 (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.
OracleOutputVisitor.visit (cyclomatic 45) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2627— OracleOutputVisitor.visit has cyclomatic complexity 45 (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.
SQLUtils.createFormatOutputVisitor (cyclomatic 45) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:521— SQLUtils.createFormatOutputVisitor has cyclomatic complexity 45 (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.
WallProvider.checkInternal (cyclomatic 45) core/src/main/java/com/alibaba/druid/wall/WallProvider.java:454— WallProvider.checkInternal has cyclomatic complexity 45 (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.
SchemaStatVisitor.visit (cyclomatic 44) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1529— SchemaStatVisitor.visit has cyclomatic complexity 44 (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.
DruidDataSource.shrink (cyclomatic 43) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:3076— DruidDataSource.shrink has cyclomatic complexity 43 (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.
SQLSelectQueryBlock.equals (cyclomatic 43) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:813— SQLSelectQueryBlock.equals has cyclomatic complexity 43 (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.
MySqlStatementParser.parseProcedureStatementList (cyclomatic 43) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8392— MySqlStatementParser.parseProcedureStatementList has cyclomatic complexity 43 (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.
OracleRowNumToLimit.visit (cyclomatic 43) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:143— OracleRowNumToLimit.visit has cyclomatic complexity 43 (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.
SQLStatementParser.parseCreate (cyclomatic 43) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4096— SQLStatementParser.parseCreate has cyclomatic complexity 43 (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.
SQLStatementParser.parseDrop (cyclomatic 43) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:841— SQLStatementParser.parseDrop has cyclomatic complexity 43 (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.
Lexer.scanSQLTypeV2 (cyclomatic 42) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1022— Lexer.scanSQLTypeV2 has cyclomatic complexity 42 (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.
SQLParser.tableAlias (cyclomatic 42) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:105— SQLParser.tableAlias has cyclomatic complexity 42 (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.
StringUtils.isNumber (cyclomatic 42) core/src/main/java/com/alibaba/druid/util/StringUtils.java:242— StringUtils.isNumber has cyclomatic complexity 42 (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.
DruidAbstractDataSource.createPhysicalConnection (cyclomatic 41) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1704— DruidAbstractDataSource.createPhysicalConnection 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.
MySqlExprParser.parseTableOptions (cyclomatic 41) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2512— MySqlExprParser.parseTableOptions 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.
OscarSelectParser.query (cyclomatic 41) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:49— OscarSelectParser.query 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.
PGSelectParser.query (cyclomatic 41) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:49— PGSelectParser.query 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.
SQLStatementParser.parseStatementListNonStandard (cyclomatic 41) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:512— SQLStatementParser.parseStatementListNonStandard has cyclomatic complexity 41 (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.
SchemaStatVisitor.visit (cyclomatic 41) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1378— SchemaStatVisitor.visit 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.
StringUtils.isNumber (cyclomatic 41) core/src/main/java/com/alibaba/druid/util/StringUtils.java:143— StringUtils.isNumber 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.
SQLSelectQueryBlock.equalsForMergeJoin (cyclomatic 40) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:924— SQLSelectQueryBlock.equalsForMergeJoin has cyclomatic complexity 40 (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.
MySqlSelectParser.parseTableSource (cyclomatic 40) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:334— MySqlSelectParser.parseTableSource has cyclomatic complexity 40 (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.
OracleStatementParser.parserAlter (cyclomatic 40) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1299— OracleStatementParser.parserAlter has cyclomatic complexity 40 (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.
PGOutputVisitor.visit (cyclomatic 40) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2270— PGOutputVisitor.visit has cyclomatic complexity 40 (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.
SQLExprParser.over (cyclomatic 40) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2665— SQLExprParser.over has cyclomatic complexity 40 (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.
DruidDataSource.getConnectionInternal (cyclomatic 39) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1550— DruidDataSource.getConnectionInternal has cyclomatic complexity 39 (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.
SQLDateExpr.check (cyclomatic 39) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:160— SQLDateExpr.check has cyclomatic complexity 39 (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.
SQLTimestampNTZExpr.check (cyclomatic 39) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:186— SQLTimestampNTZExpr.check has cyclomatic complexity 39 (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.
MySqlCreateTableParser.partitionClauseRest (cyclomatic 39) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1248— MySqlCreateTableParser.partitionClauseRest has cyclomatic complexity 39 (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.
PGExprParser.primaryRest (cyclomatic 39) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:422— PGExprParser.primaryRest has cyclomatic complexity 39 (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.
SQLExprParser.inRest (cyclomatic 39) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3208— SQLExprParser.inRest has cyclomatic complexity 39 (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.
SQLExprParser.primaryIdentifier (cyclomatic 39) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:939— SQLExprParser.primaryIdentifier has cyclomatic complexity 39 (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.
WallVisitorUtils.checkUpdate (cyclomatic 39) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:841— WallVisitorUtils.checkUpdate has cyclomatic complexity 39 (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.
WallVisitorUtils.getValue (cyclomatic 39) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:989— WallVisitorUtils.getValue has cyclomatic complexity 39 (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.
DruidDataSource.configFromPropertiesAfterInit (cyclomatic 38) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:217— DruidDataSource.configFromPropertiesAfterInit has cyclomatic complexity 38 (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.
HiveLexer.scanString (cyclomatic 38) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:120— HiveLexer.scanString has cyclomatic complexity 38 (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.
MySqlOutputVisitor.visit (cyclomatic 38) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1367— MySqlOutputVisitor.visit has cyclomatic complexity 38 (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.
MySqlExceptionSorter.isExceptionFatal (cyclomatic 37) core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:27— MySqlExceptionSorter.isExceptionFatal has cyclomatic complexity 37 (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.
MySqlStatementParser.parseCreateMaterializedViewRest (cyclomatic 37) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9231— MySqlStatementParser.parseCreateMaterializedViewRest has cyclomatic complexity 37 (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.
SQLSelectParser.parseWhere (cyclomatic 37) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:684— SQLSelectParser.parseWhere has cyclomatic complexity 37 (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.
SQLASTOutputVisitorBinaryOpSupport.visitBinaryOpExprGroup (cyclomatic 37) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitorBinaryOpSupport.java:90— SQLASTOutputVisitorBinaryOpSupport.visitBinaryOpExprGroup has cyclomatic complexity 37 (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.
SqlTypeUDF.evaluate (cyclomatic 37) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlTypeUDF.java:147— SqlTypeUDF.evaluate has cyclomatic complexity 37 (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.
WallVisitorUtils.checkUnion (cyclomatic 37) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2254— WallVisitorUtils.checkUnion has cyclomatic complexity 37 (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.
DmSelectParser.query (cyclomatic 36) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:29— DmSelectParser.query has cyclomatic complexity 36 (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.
HiveLexer.scanComment (cyclomatic 36) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:278— HiveLexer.scanComment has cyclomatic complexity 36 (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.
MySqlOutputVisitor.visit (cyclomatic 36) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2112— MySqlOutputVisitor.visit has cyclomatic complexity 36 (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.
OracleOutputVisitor.visit (cyclomatic 36) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1306— OracleOutputVisitor.visit has cyclomatic complexity 36 (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.
OscarExprParser.primaryRest (cyclomatic 36) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:234— OscarExprParser.primaryRest has cyclomatic complexity 36 (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.
OscarOutputVisitor.visit (cyclomatic 36) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1549— OscarOutputVisitor.visit has cyclomatic complexity 36 (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.
PGOutputVisitor.visit (cyclomatic 36) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1926— PGOutputVisitor.visit has cyclomatic complexity 36 (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.
Lexer.scanVariable (cyclomatic 36) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2246— Lexer.scanVariable has cyclomatic complexity 36 (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.
WallFilter.initWallProviderInternal (cyclomatic 36) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:124— WallFilter.initWallProviderInternal has cyclomatic complexity 36 (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.
MySqlLexer.scanIdentifier (cyclomatic 35) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:311— MySqlLexer.scanIdentifier 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.
SQLSelectParser.parseGroupBy (cyclomatic 35) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:893— SQLSelectParser.parseGroupBy 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.
SQLASTOutputVisitor.printTableSourceExpr (cyclomatic 35) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3006— SQLASTOutputVisitor.printTableSourceExpr 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.
SQLASTOutputVisitor.visitBinaryLeft (cyclomatic 35) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:954— SQLASTOutputVisitor.visitBinaryLeft 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.
SQLEvalVisitorUtils.div (cyclomatic 35) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1597— SQLEvalVisitorUtils.div 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.
DruidDataSourceStatLoggerImpl.log (cyclomatic 34) core/src/main/java/com/alibaba/druid/pool/DruidDataSourceStatLoggerImpl.java:84— DruidDataSourceStatLoggerImpl.log has cyclomatic complexity 34 (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.
ImpalaCreateTableParser.parseCreateTableRest (cyclomatic 34) core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:32— ImpalaCreateTableParser.parseCreateTableRest has cyclomatic complexity 34 (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.
MySqlExprParser.parseIndexOptions (cyclomatic 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:421— MySqlExprParser.parseIndexOptions has cyclomatic complexity 34 (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.
MySqlOutputVisitor.visit (cyclomatic 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2223— MySqlOutputVisitor.visit has cyclomatic complexity 34 (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.
OracleStatementParser.parseCreateIndex (cyclomatic 34) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2556— OracleStatementParser.parseCreateIndex has cyclomatic complexity 34 (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.
SQLASTOutputVisitor.visit (cyclomatic 34) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5703— SQLASTOutputVisitor.visit has cyclomatic complexity 34 (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.
SchemaStatVisitor.unwrapExpr (cyclomatic 34) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1002— SchemaStatVisitor.unwrapExpr has cyclomatic complexity 34 (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.
JdbcUtils.printResultSet (cyclomatic 34) core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:162— JdbcUtils.printResultSet has cyclomatic complexity 34 (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: JdbcUtils.getTypeName (cyclomatic 36) 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.
MySqlExprParser.parseColumnRest (cyclomatic 33) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1784— MySqlExprParser.parseColumnRest has cyclomatic complexity 33 (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.
OracleOutputVisitor.visit (cyclomatic 33) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1613— OracleOutputVisitor.visit 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.
SchemaStatVisitor.getColumn (cyclomatic 33) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:864— SchemaStatVisitor.getColumn 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.
WallVisitorUtils.preVisitCheck (cyclomatic 33) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2534— WallVisitorUtils.preVisitCheck has cyclomatic complexity 33 (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.
SQLBinaryOpExpr.computeDataType (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:565— SQLBinaryOpExpr.computeDataType 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.
SQLMethodInvokeExpr.computeDataType (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:455— SQLMethodInvokeExpr.computeDataType has cyclomatic complexity 32 (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.
MySqlLexer.scanString (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:488— MySqlLexer.scanString 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.
MySqlStatementParser.parseFlush (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2194— MySqlStatementParser.parseFlush 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.
MySqlOutputVisitor.visit (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3948— MySqlOutputVisitor.visit 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.
OracleExprParser.parseDataType (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:128— OracleExprParser.parseDataType 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.
OscarOutputVisitor.visit (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1186— OscarOutputVisitor.visit 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.
PrestoStatementParser.parseStatementListDialect (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:290— PrestoStatementParser.parseStatementListDialect 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.
SQLSelectParser.parseTableSource (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1219— SQLSelectParser.parseTableSource 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.
SchemaStatVisitor.visitOrderBy (cyclomatic 32) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:245— SchemaStatVisitor.visitOrderBy 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.
WallVisitorUtils.getValue (cyclomatic 32) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1483— WallVisitorUtils.getValue 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.
DruidDataSource.recycle (cyclomatic 31) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1901— DruidDataSource.recycle 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.
OracleToMySqlOutputVisitor.visit (cyclomatic 31) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleToMySqlOutputVisitor.java:36— OracleToMySqlOutputVisitor.visit 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.
Lexer.scanAlias (cyclomatic 31) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2089— Lexer.scanAlias 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.
SQLStatementParser.alterTableAfterName (cyclomatic 31) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2265— SQLStatementParser.alterTableAfterName 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.
SQLEvalVisitorUtils.add (cyclomatic 31) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1898— SQLEvalVisitorUtils.add has cyclomatic complexity 31 (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.
MySqlUtils.getLastPacketReceivedTimeMs (cyclomatic 31) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:394— MySqlUtils.getLastPacketReceivedTimeMs 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.
GaussDbStatementParser.parseInsert (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:45— GaussDbStatementParser.parseInsert 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.
MySqlExprParser.primaryRest (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1360— MySqlExprParser.primaryRest 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.
OracleExprParser.parseAggregateExpr (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:777— OracleExprParser.parseAggregateExpr 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.
OracleSelectParser.parseTableSourceRest (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:808— OracleSelectParser.parseTableSourceRest 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.
OracleStatementParser.parseAlterTable (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1585— OracleStatementParser.parseAlterTable 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.
SQLExprParser.expr (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:85— SQLExprParser.expr 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. This is NOT this file's highest cyclomatic complexity: SQLExprParser.parseInterval (cyclomatic 33) 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.
SQLExprParser.primarySub (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1170— SQLExprParser.primarySub has cyclomatic complexity 30 (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: SQLExprParser.parseInterval (cyclomatic 33) 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.
SchemaResolveVisitorFactory.resolve (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1887— SchemaResolveVisitorFactory.resolve 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.
SQLEvalVisitorUtils.eq (cyclomatic 30) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1826— SQLEvalVisitorUtils.eq has cyclomatic complexity 30 (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.
SqlTypeUDF.getStmtSqlType (cyclomatic 30) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlTypeUDF.java:79— SqlTypeUDF.getStmtSqlType has cyclomatic complexity 30 (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.
DB2ExprParser.primaryRest (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:63— DB2ExprParser.primaryRest 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.
MySqlOutputVisitor.visit (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5623— MySqlOutputVisitor.visit 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.
Lexer.scanIdentifier (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2585— Lexer.scanIdentifier 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. This shape REPEATS in the file: one other method here (Lexer.scanIdentifier0) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Lexer.scanIdentifier0 (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2721— Lexer.scanIdentifier0 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. This shape REPEATS in the file: one other method here (Lexer.scanIdentifier) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SQLParserUtils.split (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:693— SQLParserUtils.split 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.
SQLStatementParser.parseGrant (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1566— SQLStatementParser.parseGrant 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.
SQLEvalVisitorUtils.sub (cyclomatic 29) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1969— SQLEvalVisitorUtils.sub has cyclomatic complexity 29 (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.
DruidStatService.service (cyclomatic 29) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:78— DruidStatService.service has cyclomatic complexity 29 (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.
MySqlUtils.toJavaFormat (cyclomatic 29) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:884— MySqlUtils.toJavaFormat has cyclomatic complexity 29 (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.
BigQueryLexer.scanAlias (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:174— BigQueryLexer.scanAlias has cyclomatic complexity 28 (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.
MySqlOutputVisitor.printValuesList (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1267— MySqlOutputVisitor.printValuesList has cyclomatic complexity 28 (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.
MySqlOutputVisitor.visit (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1015— MySqlOutputVisitor.visit has cyclomatic complexity 28 (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.
OracleOutputVisitor.visit (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1722— OracleOutputVisitor.visit has cyclomatic complexity 28 (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.
OscarOutputVisitor.visit (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1668— OscarOutputVisitor.visit has cyclomatic complexity 28 (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.
PGOutputVisitor.visit (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2058— PGOutputVisitor.visit has cyclomatic complexity 28 (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.
Lexer.nextTokenValue (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:509— Lexer.nextTokenValue has cyclomatic complexity 28 (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.
SQLStatementParser.parseCreateMaterializedView (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4345— SQLStatementParser.parseCreateMaterializedView has cyclomatic complexity 28 (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.
SchemaResolveVisitorFactory.extractColumns (cyclomatic 28) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1617— SchemaResolveVisitorFactory.extractColumns has cyclomatic complexity 28 (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.
MySqlUtils.createXAConnection (cyclomatic 28) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:70— MySqlUtils.createXAConnection has cyclomatic complexity 28 (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.
CreateConnectionTask.runInternal (cyclomatic 27) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2586— CreateConnectionTask.runInternal 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.
BigQueryLexer.scanString (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:341— BigQueryLexer.scanString 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.
DmOutputVisitor.visit (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:72— DmOutputVisitor.visit has cyclomatic complexity 27 (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.
MySqlExprParser.parsePartition (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2385— MySqlExprParser.parsePartition 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.
MySqlExprParser.primaryIdentifierRest (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:172— MySqlExprParser.primaryIdentifierRest has cyclomatic complexity 27 (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.
MySqlSelectParser.parseTableSourceRest (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:683— MySqlSelectParser.parseTableSourceRest 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.
OdpsStatementParser.parsePrivilege (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1421— OdpsStatementParser.parsePrivilege has cyclomatic complexity 27 (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.
SQLExprParser.notRationalRest (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4119— SQLExprParser.notRationalRest 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. This is NOT this file's highest cyclomatic complexity: SQLExprParser.parseInterval (cyclomatic 33) 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.
SQLExprParser.primaryRest (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1590— SQLExprParser.primaryRest 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. This is NOT this file's highest cyclomatic complexity: SQLExprParser.parseInterval (cyclomatic 33) 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.
SQLStatementParser.parseCreateSequence (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4728— SQLStatementParser.parseCreateSequence has cyclomatic complexity 27 (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.
SQLStatementParser.parseCreateView (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5002— SQLStatementParser.parseCreateView 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.
SQLASTOutputVisitor.visit (cyclomatic 27) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9871— SQLASTOutputVisitor.visit 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.
DruidStatManagerFacade.mergeWallStat (cyclomatic 27) core/src/main/java/com/alibaba/druid/stat/DruidStatManagerFacade.java:211— DruidStatManagerFacade.mergeWallStat 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.
CalciteMySqlNodeVisitor.visit (cyclomatic 27) core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java:480— CalciteMySqlNodeVisitor.visit 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.
FnvHash.hashCode64 (cyclomatic 27) core/src/main/java/com/alibaba/druid/util/FnvHash.java:289— FnvHash.hashCode64 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.
WallVisitorUtils.check (cyclomatic 27) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2165— WallVisitorUtils.check 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.
ProxoolDataSource.populatePropertiesFromReference (cyclomatic 27) druid-wrapper/src/main/java/org/logicalcobwebs/proxool/ProxoolDataSource.java:275— ProxoolDataSource.populatePropertiesFromReference has cyclomatic complexity 27 (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.
CreateConnectionThread.run (cyclomatic 26) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2743— CreateConnectionThread.run 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.
SQLSelect.equals (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelect.java:349— SQLSelect.equals 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.
SQLSelectQueryBlock.cloneTo (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1033— SQLSelectQueryBlock.cloneTo has cyclomatic complexity 26 (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.
MySqlStatementParser.parseExplain (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2381— MySqlStatementParser.parseExplain 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.
MySqlStatementParser.parseLoadDataInFile (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4330— MySqlStatementParser.parseLoadDataInFile 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.
MySqlStatementParser.parseSet (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4895— MySqlStatementParser.parseSet 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.
OscarOutputVisitor.visit (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:271— OscarOutputVisitor.visit 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.
PGSelectParser.parseTableSourceTableSample (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:327— PGSelectParser.parseTableSourceTableSample 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.
SnowflakeStatementParser.parseShow (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:328— SnowflakeStatementParser.parseShow 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.
SQLStatementParser.alterSequence (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7356— SQLStatementParser.alterSequence 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.
SQLStatementParser.parseTruncate (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3674— SQLStatementParser.parseTruncate 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.
SQLASTOutputVisitor.printParameter (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3298— SQLASTOutputVisitor.printParameter has cyclomatic complexity 26 (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.
SQLASTOutputVisitor.visit (cyclomatic 26) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5588— SQLASTOutputVisitor.visit 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.
PreparedStatementProxyImpl.setObjectParameter (cyclomatic 25) core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:551— PreparedStatementProxyImpl.setObjectParameter has cyclomatic complexity 25 (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.
MySqlStatementParser.parseDeleteStatement (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:137— MySqlStatementParser.parseDeleteStatement 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.
OracleOutputVisitor.printCreateFunctionBody (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2059— OracleOutputVisitor.printCreateFunctionBody 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.
Lexer.scanString2_d (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1902— Lexer.scanString2_d 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.
SQLExprParser.parseSelectOrderByItem (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2996— SQLExprParser.parseSelectOrderByItem 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: SQLExprParser.parseInterval (cyclomatic 33) 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.
SchemaRepository.acceptCreateTable (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:966— SchemaRepository.acceptCreateTable 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.
ExportParameterVisitorUtils.exportParameter (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/visitor/ExportParameterVisitorUtils.java:80— ExportParameterVisitorUtils.exportParameter 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.
SchemaStatVisitor.handleCondition (cyclomatic 25) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:764— SchemaStatVisitor.handleCondition 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.
SQLColumnDefinition.clone (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnDefinition.java:548— SQLColumnDefinition.clone has cyclomatic complexity 24 (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.
MySqlCreateTableParser.parsePartitionBy (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1032— MySqlCreateTableParser.parsePartitionBy 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.
MySqlOutputVisitor.visit (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5098— MySqlOutputVisitor.visit 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.
OdpsLexer.scanIdentifier (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsLexer.java:144— OdpsLexer.scanIdentifier 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.
OracleSelectParser.parsePivot (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:966— OracleSelectParser.parsePivot 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.
OracleOutputVisitor.visit (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2276— OracleOutputVisitor.visit 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.
SQLServerLexer.scanComment (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:77— SQLServerLexer.scanComment 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.
SQLExprParser.parseAssignItem (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5417— SQLExprParser.parseAssignItem has cyclomatic complexity 24 (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: SQLExprParser.parseInterval (cyclomatic 33) 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.
SQLParserUtils.removeComment (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:1036— SQLParserUtils.removeComment 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.
SchemaResolveVisitorFactory.resolve (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1238— SchemaResolveVisitorFactory.resolve 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.
SQLASTOutputVisitor.visit (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5051— SQLASTOutputVisitor.visit 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.
SQLEvalVisitorUtils.gt (cyclomatic 24) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1690— SQLEvalVisitorUtils.gt has cyclomatic complexity 24 (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.
MonitorDaoJdbcImpl.load (cyclomatic 24) core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:214— MonitorDaoJdbcImpl.load has cyclomatic complexity 24 (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.
SQLSelectQueryBlock.hashCode (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:896— SQLSelectQueryBlock.hashCode has cyclomatic complexity 23 (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.
DB2OutputVisitor.visit (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2OutputVisitor.java:215— DB2OutputVisitor.visit 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.
HiveExprParser.parseSelectItemRest (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:119— HiveExprParser.parseSelectItemRest 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.
MySqlExprParser.parseInterval (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1626— MySqlExprParser.parseInterval 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.
MySqlStatementParser.parseAlterDrop (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7640— MySqlStatementParser.parseAlterDrop 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.
MySqlOutputVisitor.visit (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5024— MySqlOutputVisitor.visit 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.
OracleExprParser.parseInterval (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:994— OracleExprParser.parseInterval 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.
OracleExprParser.parseSegmentAttributes (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1927— OracleExprParser.parseSegmentAttributes has cyclomatic complexity 23 (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.
OracleLexer.scanComment (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:253— OracleLexer.scanComment 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.
OracleSelectParser.select (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:42— OracleSelectParser.select 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.
OracleStatementParser.parseFunction (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:989— OracleStatementParser.parseFunction has cyclomatic complexity 23 (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.
PGExprParser.primary (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:250— PGExprParser.primary 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.
PGSQLStatementParser.parseInsert (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:99— PGSQLStatementParser.parseInsert 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.
SQLStatementParser.parseHiveInsertStmt (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6934— SQLStatementParser.parseHiveInsertStmt 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.
SQLEvalVisitorUtils.multi (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:2041— SQLEvalVisitorUtils.multi has cyclomatic complexity 23 (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.
SchemaStatVisitor.visit (cyclomatic 23) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1747— SchemaStatVisitor.visit 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.
WallVisitorUtils.queryBlockFromIsNull (cyclomatic 23) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2381— WallVisitorUtils.queryBlockFromIsNull 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.
SQLCreateTableStatement.sort (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:772— SQLCreateTableStatement.sort 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.
DB2SelectParser.query (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:51— DB2SelectParser.query 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.
HiveOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:384— HiveOutputVisitor.visit 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.
MySqlSelectQueryBlock.accept0 (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:249— MySqlSelectQueryBlock.accept0 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.
MySqlSelectQueryBlock.equals (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:166— MySqlSelectQueryBlock.equals has cyclomatic complexity 22 (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.
MySqlLexer.skipFirstHintsOrMultiCommentAndNextToken (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:644— MySqlLexer.skipFirstHintsOrMultiCommentAndNextToken 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.
MySqlStatementParser.alterView (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5200— MySqlStatementParser.alterView 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.
MySqlShowColumnOutpuVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlShowColumnOutpuVisitor.java:36— MySqlShowColumnOutpuVisitor.visit 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.
OdpsStatementParser.parseInsert (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:829— OdpsStatementParser.parseInsert 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.
OracleStatementParser.parseCreateType (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:3061— OracleStatementParser.parseCreateType has cyclomatic complexity 22 (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.
OracleOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:347— OracleOutputVisitor.visit 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.
OscarStatementParser.parseInsert (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:97— OscarStatementParser.parseInsert 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.
PGOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2985— PGOutputVisitor.visit 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.
StarRocksOutputVisitor.visit (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:253— StarRocksOutputVisitor.visit 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.
SQLSelectParser.parseTableSourceSampleHive (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1522— SQLSelectParser.parseTableSourceSampleHive 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.
SQLStatementParser.alterMaterialized (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7587— SQLStatementParser.alterMaterialized 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.
ParameterizedOutputVisitorUtils.parameterize (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:155— ParameterizedOutputVisitorUtils.parameterize 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: ParameterizedOutputVisitorUtils.createParameterizedOutputVisitor (cyclomatic 30) 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.
SQLASTOutputVisitor.printInteger (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1807— SQLASTOutputVisitor.printInteger 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.
SQLASTOutputVisitor.printMethodParameters (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1916— SQLASTOutputVisitor.printMethodParameters 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.
SQLEvalVisitorUtils.lt (cyclomatic 22) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1757— SQLEvalVisitorUtils.lt has cyclomatic complexity 22 (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.
WallVisitorUtils.check (cyclomatic 22) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2660— WallVisitorUtils.check 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.
WallVisitorUtils.checkSchema (cyclomatic 22) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1864— WallVisitorUtils.checkSchema 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.
WallVisitorUtils.checkSelectForMultiTenant (cyclomatic 22) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:425— WallVisitorUtils.checkSelectForMultiTenant 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.
DruidDataSource.initExceptionSorter (cyclomatic 21) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1279— DruidDataSource.initExceptionSorter 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.
SQLPropertyExpr.computeDataType (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLPropertyExpr.java:342— SQLPropertyExpr.computeDataType 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.
SQLCreateTableStatement.cloneTo (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1285— SQLCreateTableStatement.cloneTo 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.
BigQueryOutputVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:280— BigQueryOutputVisitor.visit 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.
BlinkCreateTableParser.parseCreateTable (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/blink/parser/BlinkCreateTableParser.java:38— BlinkCreateTableParser.parseCreateTable 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.
CKOutputVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:420— CKOutputVisitor.visit 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.
MySqlCreateTableParser.parseConstraint (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1524— MySqlCreateTableParser.parseConstraint 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.
MySqlStatementParser.parseCreateTableSpace (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:604— MySqlStatementParser.parseCreateTableSpace 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.
MySqlStatementParser.parseReplace (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4135— MySqlStatementParser.parseReplace 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.
NameResolveVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/transform/NameResolveVisitor.java:32— NameResolveVisitor.visit 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.
OracleCreateTableParser.parseOrganization (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:394— OracleCreateTableParser.parseOrganization 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.
SQLServerStatementParser.parseStatementListDialect (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:50— SQLServerStatementParser.parseStatementListDialect 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.
SQLServerOutputVisitor.visit (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:656— SQLServerOutputVisitor.visit 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.
SQLExprParser.andRest (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3527— SQLExprParser.andRest 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. This is NOT this file's highest cyclomatic complexity: SQLExprParser.parseInterval (cyclomatic 33) 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.
SQLParserUtils.getTables (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:1115— SQLParserUtils.getTables 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.
SQLStatementParser.parseDropTable (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3311— SQLStatementParser.parseDropTable 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.
SQLStatementParser.parseHiveCreateFunction (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7701— SQLStatementParser.parseHiveCreateFunction 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.
SQLStatementParser.parseWithQuery (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5912— SQLStatementParser.parseWithQuery 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.
SQLASTOutputVisitor.printMethodParameters (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1983— SQLASTOutputVisitor.printMethodParameters 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.
SQLEvalVisitorUtils.type (cyclomatic 21) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:624— SQLEvalVisitorUtils.type 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.
JSONWriter.writeObject (cyclomatic 21) core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:57— JSONWriter.writeObject 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.
SqlTypeUDF.getSqlType (cyclomatic 21) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlTypeUDF.java:27— SqlTypeUDF.getSqlType 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.
WallFilter.preprocessResultSet (cyclomatic 21) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:1586— WallFilter.preprocessResultSet 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.
DruidDataSource.getConnectionDirect (cyclomatic 20) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1373— DruidDataSource.getConnectionDirect 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.
SQLSelectQueryBlock.acceptChild (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:738— SQLSelectQueryBlock.acceptChild 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.
AthenaCreateTableParser.parseCreateTableRest (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:28— AthenaCreateTableParser.parseCreateTableRest 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.
CKCreateTableParser.parseCreateTableRest (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKCreateTableParser.java:63— CKCreateTableParser.parseCreateTableRest 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.
DmExprParser.parseInterval (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:100— DmExprParser.parseInterval 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.
DorisOutputVisitor.visit (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:41— DorisOutputVisitor.visit 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.
MySqlExprParser.parseAssignItem (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2005— MySqlExprParser.parseAssignItem 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.
MySqlSelectIntoParser.query (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:62— MySqlSelectIntoParser.query 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.
OdpsExprParser.parseSelectItem (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:434— OdpsExprParser.parseSelectItem 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.
OdpsOutputVisitor.visit (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:246— OdpsOutputVisitor.visit 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.
OracleLexer.scanNumber (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:352— OracleLexer.scanNumber 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.
OracleLexer.scanVariable (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:165— OracleLexer.scanVariable 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.
OracleStatementParser.parseCreatePackage (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2891— OracleStatementParser.parseCreatePackage 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.
OracleRowNumToLimit.visit (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:40— OracleRowNumToLimit.visit 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.
OscarExprParser.parseInterval (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:152— OscarExprParser.parseInterval 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.
OscarLexer.scanString (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:99— OscarLexer.scanString 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.
PGLexer.scanString (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:103— PGLexer.scanString 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.
RedshiftOutputVisitor.visit (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/visitor/RedshiftOutputVisitor.java:77— RedshiftOutputVisitor.visit 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.
SnowflakeCreateTableParser.parseCreateTableRest (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeCreateTableParser.java:59— SnowflakeCreateTableParser.parseCreateTableRest 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.
SQLServerStatementParser.parseSet (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:393— SQLServerStatementParser.parseSet 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.
TDOutputVisitor.printSqlSetQuantifier (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/dialect/teradata/visitor/TDOutputVisitor.java:35— TDOutputVisitor.printSqlSetQuantifier 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.
SQLStatementParser.parseInsert0 (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3855— SQLStatementParser.parseInsert0 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.
Substring.eval (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Substring.java:93— Substring.eval 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.
SQLASTOutputVisitor.visit (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5516— SQLASTOutputVisitor.visit 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.
SQLUtils._normalize (cyclomatic 20) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1953— SQLUtils._normalize 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. This is NOT this file's highest cyclomatic complexity: SQLUtils.createSchemaStatVisitor (cyclomatic 25) 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.
WallVisitorUtils.checkInsertForMultiTenant (cyclomatic 20) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:566— WallVisitorUtils.checkInsertForMultiTenant 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.
MonitorStatService.service (cyclomatic 20) druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:150— MonitorStatService.service 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.
DruidConnectionHolder.<init> (cyclomatic 19) core/src/main/java/com/alibaba/druid/pool/DruidConnectionHolder.java:108— DruidConnectionHolder.<init> 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.
SQLDateTimeExpr.check (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateTimeExpr.java:93— SQLDateTimeExpr.check has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SQLTimeExpr.check (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimeExpr.java:105— SQLTimeExpr.check has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
GaussDbCreateTableParser.parseCreateTableRest (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:55— GaussDbCreateTableParser.parseCreateTableRest 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.
MySqlExprParser.parseSubPartition (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2316— MySqlExprParser.parseSubPartition 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.
MySqlOutputVisitor.visit (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5414— MySqlOutputVisitor.visit 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.
OdpsStatementParser.parseGrant (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1340— OdpsStatementParser.parseGrant 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.
PGOutputVisitor.printOnConflict (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:298— PGOutputVisitor.printOnConflict 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.
Lexer.scanString2 (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1799— Lexer.scanString2 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.
Lexer.scanString2PutEscapedChar (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2026— Lexer.scanString2PutEscapedChar has cyclomatic complexity 19 (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.
SQLExprParser.dotRest (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2065— SQLExprParser.dotRest 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. This is NOT this file's highest cyclomatic complexity: SQLExprParser.parseInterval (cyclomatic 33) 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.
SQLStatementParser.parseAlter (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2088— SQLStatementParser.parseAlter has cyclomatic complexity 19 (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.
SQLStatementParser.parseCreateTrigger (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4537— SQLStatementParser.parseCreateTrigger 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.
SQLStatementParser.parseDescribe (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5835— SQLStatementParser.parseDescribe 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.
SQLASTOutputVisitor.printOracleSegmentAttributes (cyclomatic 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9083— SQLASTOutputVisitor.printOracleSegmentAttributes 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.
CodeStatVisitor.preVisit (cyclomatic 19) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlCodeStat.java:166— CodeStatVisitor.preVisit 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.
WallVisitorUtils.checkConditionForMultiTenant (cyclomatic 19) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:664— WallVisitorUtils.checkConditionForMultiTenant 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.
DruidAbstractDataSource.testConnectionInternal (cyclomatic 18) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1513— DruidAbstractDataSource.testConnectionInternal 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.
DruidAbstractDataSource.validateConnection (cyclomatic 18) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1434— DruidAbstractDataSource.validateConnection 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.
DruidDataSource.handleFatalError (cyclomatic 18) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1814— DruidDataSource.handleFatalError 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.
SQLJoinTableSource.equals (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLJoinTableSource.java:651— SQLJoinTableSource.equals 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.
HiveOutputVisitor.visit (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:161— HiveOutputVisitor.visit 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.
MySqlStatementParser.createTableRest (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:268— MySqlStatementParser.createTableRest 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.
MySqlStatementParser.parseAnalyze (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:931— MySqlStatementParser.parseAnalyze 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.
MySqlStatementParser.parseCreateUser (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:776— MySqlStatementParser.parseCreateUser 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.
OdpsOutputVisitor.visit (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:397— OdpsOutputVisitor.visit 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.
OracleIntervalExpr.equals (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleIntervalExpr.java:170— OracleIntervalExpr.equals 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.
OracleUpdateStatement.equals (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUpdateStatement.java:129— OracleUpdateStatement.equals 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.
OracleExprParser.parseStorage (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1586— OracleExprParser.parseStorage 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.
PrestoSelectParser.query (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoSelectParser.java:56— PrestoSelectParser.query 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.
SQLServerOutputVisitor.visit (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:712— SQLServerOutputVisitor.visit 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.
Lexer.scanMultiLineComment (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2476— Lexer.scanMultiLineComment 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.
SQLStatementParser.parseRevoke (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1994— SQLStatementParser.parseRevoke 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.
SQLASTOutputVisitor.printFetchFirst (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2765— SQLASTOutputVisitor.printFetchFirst 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.
SQLASTOutputVisitor.visitorBinaryRight (cyclomatic 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:878— SQLASTOutputVisitor.visitorBinaryRight 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.
WallVisitorUtils.isFirstSelectTableSource (cyclomatic 18) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2001— WallVisitorUtils.isFirstSelectTableSource 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.
StatFilter.buildSlowParameters (cyclomatic 17) core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:564— StatFilter.buildSlowParameters has cyclomatic complexity 17 (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.
SQLAggregateExpr.equals (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:243— SQLAggregateExpr.equals 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.
SQLSelectQueryBlock.addWhere (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:144— SQLSelectQueryBlock.addWhere 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.
SQLSelectQueryBlock.replace (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1180— SQLSelectQueryBlock.replace has cyclomatic complexity 17 (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.
SQLIndexDefinition.cloneTo (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexDefinition.java:332— SQLIndexDefinition.cloneTo has cyclomatic complexity 17 (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.
SQLOver.equals (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/ast/SQLOver.java:211— SQLOver.equals has cyclomatic complexity 17 (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.
CKOutputVisitor.printComment (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:239— CKOutputVisitor.printComment has cyclomatic complexity 17 (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.
HologresOutputVisitor.printComment (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java:61— HologresOutputVisitor.printComment has cyclomatic complexity 17 (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.
MySqlCreateTableStatement.cloneTo (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:465— MySqlCreateTableStatement.cloneTo has cyclomatic complexity 17 (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.
MySqlStatementParser.alterDatabase (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8052— MySqlStatementParser.alterDatabase 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.
OracleExprParser.parseLobStorage (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1482— OracleExprParser.parseLobStorage 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.
OscarOutputVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1310— OscarOutputVisitor.visit 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.
PGSQLStatementParser.parseBlock (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:729— PGSQLStatementParser.parseBlock 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.
PGSQLStatementParser.parseCreateIndex (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1120— PGSQLStatementParser.parseCreateIndex 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.
PGSQLStatementParser.parseSet (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1034— PGSQLStatementParser.parseSet 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.
PGOutputVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1687— PGOutputVisitor.visit 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.
RedshiftCreateTableParser.parseCreateTableRest (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftCreateTableParser.java:52— RedshiftCreateTableParser.parseCreateTableRest 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.
SQLServerStatementParser.parseInsert0 (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:281— SQLServerStatementParser.parseInsert0 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.
Lexer.parameterize (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:3463— Lexer.parameterize has cyclomatic complexity 17 (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.
SQLParser.tableAliasFromRequiredRest (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:415— SQLParser.tableAliasFromRequiredRest has cyclomatic complexity 17 (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.
SQLSelectParser.parseGroupByItem (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1065— SQLSelectParser.parseGroupByItem 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.
SQLSelectParser.parsePivot (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2431— SQLSelectParser.parsePivot 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.
SQLSelectParser.parseSelectList (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1143— SQLSelectParser.parseSelectList 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.
SchemaResolveVisitorFactory.resolve (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2013— SchemaResolveVisitorFactory.resolve 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.
SQLASTOutputVisitor.hiveVisit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9956— SQLASTOutputVisitor.hiveVisit 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.
SQLASTOutputVisitor.printSelectList (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:566— SQLASTOutputVisitor.printSelectList 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.
SQLASTOutputVisitor.visitStatementList (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11950— SQLASTOutputVisitor.visitStatementList 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.
SQLEvalVisitorUtils.like (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:2096— SQLEvalVisitorUtils.like 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.
OracleUnorderedLimitDetectVisitor.visit (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:719— OracleUnorderedLimitDetectVisitor.visit 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: PagerUtils.limitQueryBlock (cyclomatic 20) 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.
SQLUtils.toSQLString (cyclomatic 17) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:438— SQLUtils.toSQLString 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: SQLUtils.createSchemaStatVisitor (cyclomatic 25) 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.
WebAppStat.computeUserAgentAndroid (cyclomatic 17) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:850— WebAppStat.computeUserAgentAndroid has cyclomatic complexity 17 (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.
JSONParser.nextToken (cyclomatic 17) core/src/main/java/com/alibaba/druid/support/json/JSONParser.java:157— JSONParser.nextToken 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.
DruidDataSourceUtils.configFromProperties (cyclomatic 17) core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:238— DruidDataSourceUtils.configFromProperties has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
MySqlUtils.isNumber (cyclomatic 17) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:820— MySqlUtils.isNumber 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.
WallVisitorUtils.isSimpleConstExpr (cyclomatic 17) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:295— WallVisitorUtils.isSimpleConstExpr 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.
WallVisitorUtils.isWhereOrHaving (cyclomatic 17) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1258— WallVisitorUtils.isWhereOrHaving 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.
LogFilter.configFromProperties (cyclomatic 16) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:89— LogFilter.configFromProperties 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.
SQLBinaryOpExpr.merge (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:694— SQLBinaryOpExpr.merge 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.
SQLSelectQueryBlock.addWhereForDynamicFilter (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:215— SQLSelectQueryBlock.addWhereForDynamicFilter 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.
SQLUpdateStatement.equals (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:373— SQLUpdateStatement.equals 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.
BigQueryStatementParser.parseCreateFunction (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:103— BigQueryStatementParser.parseCreateFunction 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.
DB2ExprParser.parseIdentity (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:213— DB2ExprParser.parseIdentity 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.
DmOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:41— DmOutputVisitor.visit 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.
GaussDbExprParser.parsePartitionValues (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:69— GaussDbExprParser.parsePartitionValues 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.
H2ExprParser.parseIdentity0 (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java:94— H2ExprParser.parseIdentity0 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.
HiveOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:61— HiveOutputVisitor.visit 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.
MySqlExprParser.<init> (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:108— MySqlExprParser.<init> 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.
MySqlStatementParser.parseCreateEvent (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5570— MySqlStatementParser.parseCreateEvent 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.
MySqlOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3810— MySqlOutputVisitor.visit 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.
OracleCreateTableParser.parseCreateTableSupplementalLoggingProps (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:545— OracleCreateTableParser.parseCreateTableSupplementalLoggingProps 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.
OracleExprParser.parsePartition (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1771— OracleExprParser.parsePartition 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.
OracleStatementParser.parseAlterTableSplit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1814— OracleStatementParser.parseAlterTableSplit 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.
OracleStatementParser.parseCreateSequence (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2725— OracleStatementParser.parseCreateSequence 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.
OscarOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1370— OscarOutputVisitor.visit 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.
PGSQLStatementParser.alterDatabase (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1355— PGSQLStatementParser.alterDatabase 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.
PGOutputVisitor.visit (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1747— PGOutputVisitor.visit 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.
SQLServerStatementParser.parseDeclare (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:193— SQLServerStatementParser.parseDeclare 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.
Lexer.scanLineArgument (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2424— Lexer.scanLineArgument 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.
SQLCreateTableParser.createTableBodyItem (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:117— SQLCreateTableParser.createTableBodyItem 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.
SQLExprParser.orRest (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3642— SQLExprParser.orRest 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: SQLExprParser.parseInterval (cyclomatic 33) 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.
SQLSelectParser.parseHierachical (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2240— SQLSelectParser.parseHierachical 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.
SQLStatementParser.parseAlterDrop (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3151— SQLStatementParser.parseAlterDrop 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.
SQLStatementParser.parseMergeWhen (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5709— SQLStatementParser.parseMergeWhen 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.
SQLStatementParser.parserParameters (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3529— SQLStatementParser.parserParameters 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.
SchemaRepository.console (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:465— SchemaRepository.console 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.
ParameterizedOutputVisitorUtils.parameterizeHash (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:264— ParameterizedOutputVisitorUtils.parameterizeHash 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: ParameterizedOutputVisitorUtils.createParameterizedOutputVisitor (cyclomatic 30) 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.
SQLASTOutputVisitor.printExpr (cyclomatic 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1098— SQLASTOutputVisitor.printExpr 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.
Hotspot: core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:49— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in PGSelectParser.query at line 49. 2 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-05-03..2026-08-01, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-03 19:32:53 +08:00' --until='2026-08-01 19:32:53 +08:00' --full-history --no-merges -- core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.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.
HackComment core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1417— // Hack here: Set previous comma to deal with negative number. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
XxxComment core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:3023— // XXX: not robust — 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.
MySqlStatementParser.parseShow (cognitive 475) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2497— MySqlStatementParser.parseShow has cognitive complexity 475 (threshold 15). Drivers by points: if/else 260 (446 pts), boolean chains 24, loops 2 (5 pts) (nesting depth added 189). 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.
SQLSelectParser.parseTableSourceRest (cognitive 340) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1601— SQLSelectParser.parseTableSourceRest has cognitive complexity 340 (threshold 15). Drivers by points: if/else 108 (270 pts), boolean chains 41, ternaries 5 (14 pts), loops 3 (8 pts), match/switch 3 (7 pts) (nesting depth added 180). 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.
MySqlCreateTableParser.parseCreateTable (cognitive 317) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:91— MySqlCreateTableParser.parseCreateTable has cognitive complexity 317 (threshold 15). Drivers by points: if/else 106 (285 pts), loops 4 (17 pts), boolean chains 15 (nesting depth added 192). 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.
OracleStatementParser.parseStatementList (cognitive 282) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:69— OracleStatementParser.parseStatementList has cognitive complexity 282 (threshold 15). Drivers by points: if/else 106 (264 pts), loops 4 (12 pts), boolean chains 6 (nesting depth added 166). 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.
MySqlStatementParser.parseAlterSpecification (cognitive 254) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5783— MySqlStatementParser.parseAlterSpecification has cognitive complexity 254 (threshold 15). Drivers by points: if/else 105 (223 pts), loops 6 (20 pts), boolean chains 4, match/switch 2 (4 pts), error handling 1 (3 pts) (nesting depth added 136). 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.
SQLStatementParser.parseValueClauseNative (cognitive 242) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6057— SQLStatementParser.parseValueClauseNative has cognitive complexity 242 (threshold 15). Drivers by points: if/else 70 (214 pts), boolean chains 18, loops 3 (6 pts), match/switch 1 (4 pts) (nesting depth added 150). 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.
MySqlStatementParser.parseStatementListDialect (cognitive 230) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1046— MySqlStatementParser.parseStatementListDialect has cognitive complexity 230 (threshold 15). Drivers by points: if/else 112 (178 pts), boolean chains 25, loops 8 (25 pts), match/switch 1 (2 pts) (nesting depth added 84). 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.
SQLStatementParser.parseValueClause (cognitive 225) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6662— SQLStatementParser.parseValueClause has cognitive complexity 225 (threshold 15). Drivers by points: if/else 69 (206 pts), boolean chains 13, loops 3 (6 pts) (nesting depth added 140). 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.
MySqlStatementParser.parseInsert (cognitive 211) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4535— MySqlStatementParser.parseInsert has cognitive complexity 211 (threshold 15). Drivers by points: if/else 64 (172 pts), loops 8 (30 pts), boolean chains 6, error handling 1 (3 pts) (nesting depth added 132). 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.
MySqlCreateTableParser.parseOptions (cognitive 185) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:628— MySqlCreateTableParser.parseOptions has cognitive complexity 185 (threshold 15). Drivers by points: if/else 66 (160 pts), loops 7 (21 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 110). 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.
Lexer.scanSQLType (cognitive 185) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:696— Lexer.scanSQLType has cognitive complexity 185 (threshold 15). Drivers by points: if/else 113 (152 pts), boolean chains 19, loops 7 (14 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.
MySqlExprParser.primary (cognitive 178) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:915— MySqlExprParser.primary has cognitive complexity 178 (threshold 15). Drivers by points: if/else 78 (143 pts), boolean chains 23, loops 1 (4 pts), ternaries 1 (4 pts), error handling 1 (3 pts), match/switch 1 (nesting depth added 73). 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.
SQLStatementParser.parseValueClause (cognitive 166) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6388— SQLStatementParser.parseValueClause has cognitive complexity 166 (threshold 15). Drivers by points: if/else 53 (144 pts), boolean chains 12, loops 3 (6 pts), match/switch 1 (4 pts) (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.
SQLExprParser.parseSelectItem (cognitive 165) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5859— SQLExprParser.parseSelectItem has cognitive complexity 165 (threshold 15). Drivers by points: if/else 65 (128 pts), boolean chains 26, loops 3 (9 pts), match/switch 1 (2 pts) (nesting depth added 70). 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.
OdpsCreateTableParser.parseCreateTable (cognitive 160) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:39— OdpsCreateTableParser.parseCreateTable has cognitive complexity 160 (threshold 15). Drivers by points: if/else 58 (129 pts), loops 6 (13 pts), boolean chains 11, match/switch 2 (7 pts) (nesting depth added 83). 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.
OdpsStatementParser.parseStatementListDialect (cognitive 157) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:84— OdpsStatementParser.parseStatementListDialect has cognitive complexity 157 (threshold 15). Drivers by points: if/else 72 (133 pts), boolean chains 11, match/switch 2 (7 pts), error handling 1 (4 pts), loops 1 (2 pts) (nesting depth added 70). 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.
SQLASTOutputVisitor.visit (cognitive 148) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1522— SQLASTOutputVisitor.visit has cognitive complexity 148 (threshold 15). Drivers by points: if/else 39 (96 pts), loops 8 (29 pts), ternaries 4 (12 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 87). 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.
SQLEvalVisitorUtils.visit (cognitive 148) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:184— SQLEvalVisitorUtils.visit has cognitive complexity 148 (threshold 15). Drivers by points: if/else 74 (139 pts), boolean chains 8, match/switch 1 (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.
MySqlUtils.parseDateTime (cognitive 147) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1436— MySqlUtils.parseDateTime has cognitive complexity 147 (threshold 15). Drivers by points: if/else 68 (123 pts), boolean chains 22, match/switch 2 (nesting depth added 55). 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.
SchemaResolveVisitorFactory.resolveIdent (cognitive 143) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1029— SchemaResolveVisitorFactory.resolveIdent has cognitive complexity 143 (threshold 15). Drivers by points: if/else 49 (124 pts), boolean chains 13, loops 3 (6 pts) (nesting depth added 78). 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.
SQLTimestampExpr.check (cognitive 140) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:256— SQLTimestampExpr.check has cognitive complexity 140 (threshold 15). Drivers by points: if/else 76 (116 pts), boolean chains 23, match/switch 1 (nesting depth added 40). 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.
OracleCreateTableParser.parseCreateTable (cognitive 139) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:48— OracleCreateTableParser.parseCreateTable has cognitive complexity 139 (threshold 15). Drivers by points: if/else 59 (119 pts), loops 4 (14 pts), match/switch 1 (6 pts) (nesting depth added 75). 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.
SQLSelectParser.queryRest (cognitive 137) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:153— SQLSelectParser.queryRest has cognitive complexity 137 (threshold 15). Drivers by points: if/else 46 (118 pts), ternaries 2 (7 pts), loops 2 (5 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 82). 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.
MySqlUtils.parseDate (cognitive 128) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:978— MySqlUtils.parseDate has cognitive complexity 128 (threshold 15). Drivers by points: if/else 63 (101 pts), boolean chains 24, match/switch 2, ternaries 1 (nesting depth added 38). 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.
SQLStatementParser.parsePrivilege (cognitive 127) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1709— SQLStatementParser.parsePrivilege has cognitive complexity 127 (threshold 15). Drivers by points: if/else 85 (121 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 39). 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.
OracleStatementParser.parserParameters (cognitive 126) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2005— OracleStatementParser.parserParameters has cognitive complexity 126 (threshold 15). Drivers by points: if/else 48 (117 pts), boolean chains 8, loops 1 (nesting depth added 69). 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.
Lexer.nextToken (cognitive 126) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1252— Lexer.nextToken has cognitive complexity 126 (threshold 15). Drivers by points: if/else 40 (96 pts), boolean chains 23, match/switch 2 (6 pts), loops 1 (nesting depth added 60). 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.
SchemaStatVisitor.unwrapExpr (cognitive 125) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1002— SchemaStatVisitor.unwrapExpr has cognitive complexity 125 (threshold 15). Drivers by points: if/else 31 (121 pts), boolean chains 3, loops 1 (nesting depth added 90). 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.
WallVisitorUtils.checkUpdate (cognitive 125) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:841— WallVisitorUtils.checkUpdate has cognitive complexity 125 (threshold 15). Drivers by points: if/else 31 (97 pts), loops 5 (22 pts), boolean chains 6 (nesting depth added 83). 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.
OdpsExprParser.primaryRest (cognitive 122) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:537— OdpsExprParser.primaryRest has cognitive complexity 122 (threshold 15). Drivers by points: if/else 33 (85 pts), loops 7 (25 pts), boolean chains 9, match/switch 1 (3 pts) (nesting depth added 72). 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.
OracleRowNumToLimit.visit (cognitive 119) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:143— OracleRowNumToLimit.visit has cognitive complexity 119 (threshold 15). Drivers by points: if/else 34 (97 pts), boolean chains 12, ternaries 2 (10 pts) (nesting depth added 71). 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.
MySqlExprParser.parseTableOptions (cognitive 117) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2512— MySqlExprParser.parseTableOptions has cognitive complexity 117 (threshold 15). Drivers by points: if/else 39 (106 pts), boolean chains 6, ternaries 1 (4 pts), loops 1 (nesting depth added 70). 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.
SQLExprParser.inRest (cognitive 115) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3208— SQLExprParser.inRest has cognitive complexity 115 (threshold 15). Drivers by points: if/else 31 (97 pts), boolean chains 7, loops 2 (7 pts), match/switch 1 (4 pts) (nesting depth added 74). 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.
SQLASTOutputVisitor.visit (cognitive 114) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10478— SQLASTOutputVisitor.visit has cognitive complexity 114 (threshold 15). Drivers by points: ternaries 28 (63 pts), if/else 34 (42 pts), loops 5 (8 pts), boolean chains 1 (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.
SQLASTOutputVisitor.visit (cognitive 113) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9386— SQLASTOutputVisitor.visit has cognitive complexity 113 (threshold 15). Drivers by points: ternaries 24 (69 pts), if/else 27 (42 pts), loops 1 (2 pts) (nesting depth added 61). 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.
MySqlOutputVisitor.visit (cognitive 110) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:94— MySqlOutputVisitor.visit has cognitive complexity 110 (threshold 15). Drivers by points: ternaries 22 (63 pts), if/else 26 (41 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 58). 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.
MySqlExprParser.parseSelectItemRest (cognitive 109) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:564— MySqlExprParser.parseSelectItemRest has cognitive complexity 109 (threshold 15). Drivers by points: if/else 58 (88 pts), boolean chains 21 (nesting depth added 30). 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.
SQLASTOutputVisitor.visit (cognitive 109) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7870— SQLASTOutputVisitor.visit has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 16 (57 pts), if/else 24 (48 pts), boolean chains 4 (nesting depth added 65). 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.
TDDLHint.<init> (cognitive 107) core/src/main/java/com/alibaba/druid/sql/ast/TDDLHint.java:24— TDDLHint.<init> has cognitive complexity 107 (threshold 15). Drivers by points: if/else 41 (94 pts), loops 3 (8 pts), boolean chains 4, match/switch 1 (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.
SchemaResolveVisitorFactory.resolve (cognitive 106) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1401— SchemaResolveVisitorFactory.resolve has cognitive complexity 106 (threshold 15). Drivers by points: if/else 43 (87 pts), loops 8 (17 pts), boolean chains 2 (nesting depth added 53). 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.
PGOutputVisitor.visit (cognitive 105) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2270— PGOutputVisitor.visit has cognitive complexity 105 (threshold 15). Drivers by points: ternaries 15 (54 pts), if/else 24 (47 pts), boolean chains 4 (nesting depth added 62). 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.
MySqlOutputVisitor.visit (cognitive 103) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1103— MySqlOutputVisitor.visit has cognitive complexity 103 (threshold 15). Drivers by points: if/else 34 (66 pts), ternaries 12 (25 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 51). 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.
MySqlLexer.scanComment (cognitive 102) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:726— MySqlLexer.scanComment has cognitive complexity 102 (threshold 15). Drivers by points: if/else 33 (68 pts), boolean chains 22, loops 5 (10 pts), ternaries 1 (2 pts) (nesting depth added 41). 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.
DruidDataSource.shrink (cognitive 101) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:3076— DruidDataSource.shrink has cognitive complexity 101 (threshold 15). Drivers by points: if/else 32 (78 pts), error handling 4 (13 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 57). 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.
MySqlStatementParser.parseCreateDatabase (cognitive 99) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7813— MySqlStatementParser.parseCreateDatabase has cognitive complexity 99 (threshold 15). Drivers by points: if/else 39 (76 pts), loops 7 (19 pts), boolean chains 4 (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.
SQLExprParser.methodRest (cognitive 99) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1771— SQLExprParser.methodRest has cognitive complexity 99 (threshold 15). Drivers by points: if/else 57 (89 pts), boolean chains 7, loops 1 (3 pts) (nesting depth added 34). 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.
WebAppStat.computeUserAgent (cognitive 99) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:524— WebAppStat.computeUserAgent has cognitive complexity 99 (threshold 15). Drivers by points: if/else 74 (88 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 15). 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.
MySqlStatementParser.parseCreateMaterializedViewRest (cognitive 96) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9231— MySqlStatementParser.parseCreateMaterializedViewRest has cognitive complexity 96 (threshold 15). Drivers by points: if/else 33 (84 pts), loops 4 (11 pts), boolean chains 1 (nesting depth added 58). 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.
SQLStatementParser.parseStatementList (cognitive 96) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:131— SQLStatementParser.parseStatementList has cognitive complexity 96 (threshold 15). Drivers by points: if/else 28 (76 pts), boolean chains 11, loops 3 (7 pts), match/switch 1 (2 pts) (nesting depth added 53). 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.
SQLExprParser.parseColumnRest (cognitive 95) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4855— SQLExprParser.parseColumnRest has cognitive complexity 95 (threshold 15). Drivers by points: if/else 34 (92 pts), boolean chains 2, match/switch 1 (nesting depth added 58). 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.
SQLASTOutputVisitor.visit (cognitive 95) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8737— SQLASTOutputVisitor.visit has cognitive complexity 95 (threshold 15). Drivers by points: ternaries 24 (58 pts), if/else 28 (36 pts), boolean chains 1 (nesting depth added 42). 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.
MySqlOutputVisitor.visit (cognitive 94) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:259— MySqlOutputVisitor.visit has cognitive complexity 94 (threshold 15). Drivers by points: ternaries 28 (56 pts), if/else 32 (34 pts), boolean chains 2, loops 2 (nesting depth added 30). 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.
MySqlOutputVisitor.visit (cognitive 93) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2112— MySqlOutputVisitor.visit has cognitive complexity 93 (threshold 15). Drivers by points: if/else 26 (59 pts), ternaries 10 (29 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 54). 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.
SQLASTOutputVisitor.visit (cognitive 93) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8848— SQLASTOutputVisitor.visit has cognitive complexity 93 (threshold 15). Drivers by points: ternaries 22 (56 pts), if/else 27 (36 pts), boolean chains 1 (nesting depth added 43). 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.
SchemaStatVisitor.visit (cognitive 93) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1378— SchemaStatVisitor.visit has cognitive complexity 93 (threshold 15). Drivers by points: if/else 35 (86 pts), boolean chains 5, loops 1 (2 pts) (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.
MySqlCreateTableParser.partitionClauseRest (cognitive 92) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1248— MySqlCreateTableParser.partitionClauseRest has cognitive complexity 92 (threshold 15). Drivers by points: if/else 32 (73 pts), loops 4 (14 pts), boolean chains 5 (nesting depth added 51). 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.
SQLParserUtils.splitAndRemoveComment (cognitive 92) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:802— SQLParserUtils.splitAndRemoveComment has cognitive complexity 92 (threshold 15). Drivers by points: if/else 30 (63 pts), boolean chains 16, ternaries 3 (10 pts), loops 3 (nesting depth added 40). 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.
Lexer.scanNumber (cognitive 91) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2852— Lexer.scanNumber has cognitive complexity 91 (threshold 15). Drivers by points: if/else 27 (58 pts), boolean chains 23, loops 5 (10 pts) (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.
SQLASTOutputVisitor.visitInternal (cognitive 91) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:703— SQLASTOutputVisitor.visitInternal has cognitive complexity 91 (threshold 15). Drivers by points: if/else 31 (63 pts), boolean chains 16, loops 3 (6 pts), ternaries 1 (6 pts) (nesting depth added 40). 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.
DruidDataSource.getConnectionInternal (cognitive 90) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1550— DruidDataSource.getConnectionInternal has cognitive complexity 90 (threshold 15). Drivers by points: if/else 31 (75 pts), boolean chains 6, error handling 3 (6 pts), loops 2 (3 pts) (nesting depth added 48). 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.
MySqlStatementParser.parseProcedureStatementList (cognitive 88) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8392— MySqlStatementParser.parseProcedureStatementList has cognitive complexity 88 (threshold 15). Drivers by points: if/else 41 (85 pts), boolean chains 2, loops 1 (nesting depth added 44). 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.
OracleStatementParser.parserAlter (cognitive 88) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1299— OracleStatementParser.parserAlter has cognitive complexity 88 (threshold 15). Drivers by points: if/else 38 (73 pts), loops 5 (15 pts) (nesting depth added 45). 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.
Lexer.scanOperator (cognitive 88) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1527— Lexer.scanOperator has cognitive complexity 88 (threshold 15). Drivers by points: if/else 53 (83 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 31). 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.
SQLASTOutputVisitorBinaryOpSupport.visitBinaryOpExprGroup (cognitive 87) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitorBinaryOpSupport.java:90— SQLASTOutputVisitorBinaryOpSupport.visitBinaryOpExprGroup has cognitive complexity 87 (threshold 15). Drivers by points: if/else 28 (71 pts), boolean chains 8, loops 3 (8 pts) (nesting depth added 48). 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.
SchemaRepository.acceptCreateTable (cognitive 86) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:966— SchemaRepository.acceptCreateTable has cognitive complexity 86 (threshold 15). Drivers by points: if/else 19 (68 pts), loops 2 (11 pts), error handling 1 (5 pts), boolean chains 2 (nesting depth added 62). 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.
OracleOutputVisitor.visit (cognitive 85) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2627— OracleOutputVisitor.visit has cognitive complexity 85 (threshold 15). Drivers by points: ternaries 17 (41 pts), if/else 28 (38 pts), boolean chains 4, loops 1 (2 pts) (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.
SchemaStatVisitor.visit (cognitive 85) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1529— SchemaStatVisitor.visit has cognitive complexity 85 (threshold 15). Drivers by points: if/else 33 (72 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 40). 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.
JdbcUtils.getDriverClassName (cognitive 85) core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:395— JdbcUtils.getDriverClassName has cognitive complexity 85 (threshold 15). Drivers by points: if/else 75 (83 pts), boolean chains 2 (nesting depth added 8). 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.
OracleExprParser.parseAggregateExpr (cognitive 83) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:777— OracleExprParser.parseAggregateExpr has cognitive complexity 83 (threshold 15). Drivers by points: if/else 38 (83 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.
HiveCreateTableParser.parseCreateTableRest (cognitive 82) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:127— HiveCreateTableParser.parseCreateTableRest has cognitive complexity 82 (threshold 15). Drivers by points: if/else 44 (70 pts), boolean chains 6, loops 3 (6 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.
OscarSelectParser.query (cognitive 82) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:49— OscarSelectParser.query has cognitive complexity 82 (threshold 15). Drivers by points: if/else 42 (71 pts), loops 3 (8 pts), boolean chains 3 (nesting depth added 34). 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.
JdbcUtils.printResultSet (cognitive 82) core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:162— JdbcUtils.printResultSet has cognitive complexity 82 (threshold 15). Drivers by points: if/else 39 (75 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 38). 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.
PGSelectParser.query (cognitive 81) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:49— PGSelectParser.query has cognitive complexity 81 (threshold 15). Drivers by points: if/else 42 (70 pts), loops 3 (8 pts), boolean chains 3 (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.
MySqlSelectParser.parseTableSource (cognitive 80) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:334— MySqlSelectParser.parseTableSource has cognitive complexity 80 (threshold 15). Drivers by points: if/else 30 (67 pts), boolean chains 13 (nesting depth added 37). 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.
HiveLexer.scanComment (cognitive 79) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:278— HiveLexer.scanComment has cognitive complexity 79 (threshold 15). Drivers by points: if/else 25 (60 pts), loops 4 (11 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 43). 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.
MySqlOutputVisitor.visit (cognitive 79) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:521— MySqlOutputVisitor.visit has cognitive complexity 79 (threshold 15). Drivers by points: ternaries 19 (40 pts), if/else 26 (34 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 30). 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.
OdpsSelectParser.query (cognitive 79) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsSelectParser.java:45— OdpsSelectParser.query has cognitive complexity 79 (threshold 15). Drivers by points: if/else 37 (65 pts), loops 3 (6 pts), boolean chains 4, match/switch 1 (4 pts) (nesting depth added 34). 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.
OracleExprParser.primaryRest (cognitive 79) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:535— OracleExprParser.primaryRest has cognitive complexity 79 (threshold 15). Drivers by points: if/else 37 (71 pts), boolean chains 5, match/switch 1 (3 pts) (nesting depth added 36). 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.
SchemaStatVisitor.getColumn (cognitive 79) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:864— SchemaStatVisitor.getColumn has cognitive complexity 79 (threshold 15). Drivers by points: if/else 27 (73 pts), boolean chains 6 (nesting depth added 46). 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.
JdbcUtils.getDbTypeRaw (cognitive 79) core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:562— JdbcUtils.getDbTypeRaw has cognitive complexity 79 (threshold 15). Drivers by points: if/else 62 (63 pts), boolean chains 16 (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.
HiveStatementParser.parseStatementListDialect (cognitive 78) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:121— HiveStatementParser.parseStatementListDialect has cognitive complexity 78 (threshold 15). Drivers by points: if/else 33 (73 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 41). 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.
OdpsStatementParser.parseShow (cognitive 78) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:961— OdpsStatementParser.parseShow has cognitive complexity 78 (threshold 15). Drivers by points: if/else 47 (75 pts), boolean chains 3 (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.
MySqlExprParser.parseIndexOptions (cognitive 77) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:421— MySqlExprParser.parseIndexOptions has cognitive complexity 77 (threshold 15). Drivers by points: if/else 28 (67 pts), loops 2 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 44). 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.
MySqlLexer.scanIdentifier (cognitive 77) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:311— MySqlLexer.scanIdentifier has cognitive complexity 77 (threshold 15). Drivers by points: if/else 26 (53 pts), boolean chains 8, loops 4 (8 pts), ternaries 3 (8 pts) (nesting depth added 36). 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.
SQLSelectParser.parseGroupBy (cognitive 77) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:893— SQLSelectParser.parseGroupBy has cognitive complexity 77 (threshold 15). Drivers by points: if/else 26 (58 pts), loops 3 (9 pts), boolean chains 6, ternaries 1 (4 pts) (nesting depth added 41). 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.
OracleToMySqlOutputVisitor.visit (cognitive 76) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleToMySqlOutputVisitor.java:36— OracleToMySqlOutputVisitor.visit has cognitive complexity 76 (threshold 15). Drivers by points: if/else 23 (58 pts), ternaries 2 (10 pts), boolean chains 5, loops 1 (3 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.
OracleStatementParser.parseCreateIndex (cognitive 73) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2556— OracleStatementParser.parseCreateIndex has cognitive complexity 73 (threshold 15). Drivers by points: if/else 30 (56 pts), loops 5 (17 pts) (nesting depth added 38). 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.
PrestoStatementParser.parseStatementListDialect (cognitive 73) core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:290— PrestoStatementParser.parseStatementListDialect has cognitive complexity 73 (threshold 15). Drivers by points: if/else 28 (70 pts), boolean chains 3 (nesting depth added 42). 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.
SQLExprParser.parseDataType (cognitive 73) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4296— SQLExprParser.parseDataType has cognitive complexity 73 (threshold 15). Drivers by points: if/else 40 (61 pts), boolean chains 8, loops 2 (4 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.
SQLASTOutputVisitor.printTableSourceExpr (cognitive 73) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3006— SQLASTOutputVisitor.printTableSourceExpr has cognitive complexity 73 (threshold 15). Drivers by points: if/else 35 (68 pts), boolean chains 5 (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.
MySqlOutputVisitor.visit (cognitive 72) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4794— MySqlOutputVisitor.visit has cognitive complexity 72 (threshold 15). Drivers by points: ternaries 21 (44 pts), if/else 22 (27 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 72) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5703— SQLASTOutputVisitor.visit has cognitive complexity 72 (threshold 15). Drivers by points: if/else 18 (33 pts), ternaries 13 (32 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 38). 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.
WallProvider.checkInternal (cognitive 72) core/src/main/java/com/alibaba/druid/wall/WallProvider.java:454— WallProvider.checkInternal has cognitive complexity 72 (threshold 15). Drivers by points: if/else 29 (49 pts), boolean chains 10, loops 3 (7 pts), error handling 4 (6 pts) (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.
OracleCreateTableParser.parseOrganization (cognitive 71) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:394— OracleCreateTableParser.parseOrganization has cognitive complexity 71 (threshold 15). Drivers by points: if/else 24 (71 pts) (nesting depth added 47). 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.
Lexer.scanSQLTypeV2 (cognitive 71) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1022— Lexer.scanSQLTypeV2 has cognitive complexity 71 (threshold 15). Drivers by points: if/else 25 (50 pts), ternaries 2 (8 pts), boolean chains 6, loops 2 (4 pts), match/switch 1 (3 pts) (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.
OscarOutputVisitor.visit (cognitive 70) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1549— OscarOutputVisitor.visit has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (33 pts), ternaries 14 (33 pts), boolean chains 2, loops 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.
PGOutputVisitor.visit (cognitive 70) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1926— PGOutputVisitor.visit has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (33 pts), ternaries 14 (33 pts), boolean chains 2, loops 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.
SQLExprParser.over (cognitive 70) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2665— SQLExprParser.over has cognitive complexity 70 (threshold 15). Drivers by points: if/else 28 (58 pts), boolean chains 8, match/switch 1 (4 pts) (nesting depth added 33). 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.
GaussDbStatementParser.parseInsert (cognitive 69) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:45— GaussDbStatementParser.parseInsert has cognitive complexity 69 (threshold 15). Drivers by points: if/else 26 (55 pts), loops 3 (10 pts), error handling 1 (4 pts) (nesting depth added 39). 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.
OracleSelectParser.parsePivot (cognitive 69) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:966— OracleSelectParser.parsePivot has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (51 pts), loops 6 (18 pts) (nesting depth added 41). 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.
WallVisitorUtils.checkSchema (cognitive 69) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1864— WallVisitorUtils.checkSchema has cognitive complexity 69 (threshold 15). Drivers by points: if/else 14 (54 pts), loops 2 (10 pts), boolean chains 5 (nesting depth added 48). 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.
SQLDataTypeImpl.jdbcType (cognitive 68) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:178— SQLDataTypeImpl.jdbcType has cognitive complexity 68 (threshold 15). Drivers by points: if/else 48, boolean chains 20. 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.
DmSelectParser.query (cognitive 68) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:29— DmSelectParser.query has cognitive complexity 68 (threshold 15). Drivers by points: if/else 38 (61 pts), loops 2 (4 pts), boolean chains 3 (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.
SchemaResolveVisitorFactory.extractColumns (cognitive 68) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1617— SchemaResolveVisitorFactory.extractColumns has cognitive complexity 68 (threshold 15). Drivers by points: if/else 21 (51 pts), loops 6 (16 pts), boolean chains 1 (nesting depth added 40). 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.
MySqlSelectParser.query (cognitive 67) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:94— MySqlSelectParser.query has cognitive complexity 67 (threshold 15). Drivers by points: if/else 44 (59 pts), boolean chains 4, loops 2 (4 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.
MySqlOutputVisitor.visit (cognitive 67) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1367— MySqlOutputVisitor.visit has cognitive complexity 67 (threshold 15). Drivers by points: ternaries 19 (42 pts), if/else 16 (23 pts), boolean chains 2 (nesting depth added 30). 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.
SQLASTOutputVisitor.visit (cognitive 67) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5335— SQLASTOutputVisitor.visit has cognitive complexity 67 (threshold 15). Drivers by points: ternaries 17 (36 pts), if/else 19 (23 pts), loops 3 (6 pts), boolean chains 2 (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.
SchemaStatVisitor.visitOrderBy (cognitive 67) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:245— SchemaStatVisitor.visitOrderBy has cognitive complexity 67 (threshold 15). Drivers by points: if/else 29 (61 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 33). 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.
DruidDataSource.init (cognitive 66) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:659— DruidDataSource.init has cognitive complexity 66 (threshold 15). Drivers by points: if/else 33 (43 pts), error handling 6 (8 pts), loops 4 (8 pts), boolean chains 7 (nesting depth added 16). 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.
Lexer.scanVariable (cognitive 66) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2246— Lexer.scanVariable has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (42 pts), boolean chains 11, loops 5 (11 pts), ternaries 1 (2 pts) (nesting depth added 31). 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.
SchemaResolveVisitorFactory.resolve (cognitive 66) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1887— SchemaResolveVisitorFactory.resolve has cognitive complexity 66 (threshold 15). Drivers by points: if/else 26 (63 pts), boolean chains 3 (nesting depth added 37). 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.
WallVisitorUtils.queryBlockFromIsNull (cognitive 66) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2381— WallVisitorUtils.queryBlockFromIsNull has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (55 pts), loops 2 (8 pts), boolean chains 3 (nesting depth added 43). 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.
SqlTypeUDF.evaluate (cognitive 65) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlTypeUDF.java:147— SqlTypeUDF.evaluate has cognitive complexity 65 (threshold 15). Drivers by points: if/else 21 (42 pts), loops 5 (10 pts), boolean chains 5, error handling 3 (4 pts), match/switch 1 (3 pts), ternaries 1 (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.
SQLSelectParser.parseTableSource (cognitive 64) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1219— SQLSelectParser.parseTableSource has cognitive complexity 64 (threshold 15). Drivers by points: if/else 26 (53 pts), boolean chains 6, loops 2 (5 pts) (nesting depth added 30). 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.
SQLASTOutputVisitor.visit (cognitive 64) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4715— SQLASTOutputVisitor.visit has cognitive complexity 64 (threshold 15). Drivers by points: if/else 27 (49 pts), boolean chains 6, loops 3 (6 pts), ternaries 1 (3 pts) (nesting depth added 27). 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.
StringUtils.isNumber (cognitive 64) core/src/main/java/com/alibaba/druid/util/StringUtils.java:242— StringUtils.isNumber has cognitive complexity 64 (threshold 15). Drivers by points: if/else 20 (40 pts), boolean chains 19, loops 2 (4 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.
MySqlExprParser.primaryRest (cognitive 62) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1360— MySqlExprParser.primaryRest has cognitive complexity 62 (threshold 15). Drivers by points: if/else 27 (56 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 31). 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.
SQLExprParser.relationalRest (cognitive 62) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3742— SQLExprParser.relationalRest has cognitive complexity 62 (threshold 15). Drivers by points: if/else 33 (53 pts), match/switch 3 (4 pts), boolean chains 3, error handling 1 (2 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.
MySqlUtils.createXAConnection (cognitive 62) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:70— MySqlUtils.createXAConnection has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (31 pts), error handling 9 (25 pts), boolean chains 6 (nesting depth added 33). 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.
StringUtils.isNumber (cognitive 62) core/src/main/java/com/alibaba/druid/util/StringUtils.java:143— StringUtils.isNumber has cognitive complexity 62 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 19, loops 2 (4 pts), ternaries 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.
DruidAbstractDataSource.createPhysicalConnection (cognitive 61) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1704— DruidAbstractDataSource.createPhysicalConnection has cognitive complexity 61 (threshold 15). Drivers by points: if/else 27 (45 pts), boolean chains 7, error handling 5 (7 pts), ternaries 2 (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.
CalciteMySqlNodeVisitor.visit (cognitive 61) core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java:1008— CalciteMySqlNodeVisitor.visit has cognitive complexity 61 (threshold 15). Drivers by points: if/else 41 (57 pts), boolean chains 3, match/switch 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.
HiveLexer.scanString (cognitive 60) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:120— HiveLexer.scanString has cognitive complexity 60 (threshold 15). Drivers by points: if/else 23 (46 pts), loops 3 (7 pts), boolean chains 4, match/switch 1 (3 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.
MySqlOutputVisitor.printValuesList (cognitive 60) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1267— MySqlOutputVisitor.printValuesList has cognitive complexity 60 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 6 (18 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 32). 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.
DruidDataSourceFactory.config (cognitive 59) core/src/main/java/com/alibaba/druid/pool/DruidDataSourceFactory.java:179— DruidDataSourceFactory.config has cognitive complexity 59 (threshold 15). Drivers by points: if/else 48 (55 pts), error handling 1 (3 pts), loops 1 (nesting depth added 9). 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.
OracleStatementParser.parseAlterTable (cognitive 59) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1585— OracleStatementParser.parseAlterTable has cognitive complexity 59 (threshold 15). Drivers by points: if/else 33 (53 pts), loops 2 (5 pts), boolean chains 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.
SQLParser.tableAlias (cognitive 59) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:105— SQLParser.tableAlias has cognitive complexity 59 (threshold 15). Drivers by points: if/else 21 (47 pts), boolean chains 9, match/switch 1 (3 pts) (nesting depth added 28). 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.
SQLASTOutputVisitor.visitBinaryLeft (cognitive 59) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:954— SQLASTOutputVisitor.visitBinaryLeft has cognitive complexity 59 (threshold 15). Drivers by points: if/else 30 (49 pts), boolean chains 8, match/switch 1 (2 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.
MySqlUtils.getLastPacketReceivedTimeMs (cognitive 59) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:394— MySqlUtils.getLastPacketReceivedTimeMs has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (36 pts), error handling 7 (18 pts), boolean chains 5 (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.
OdpsStatementParser.parseInsert (cognitive 58) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:829— OdpsStatementParser.parseInsert has cognitive complexity 58 (threshold 15). Drivers by points: if/else 22 (54 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 33). 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.
Lexer.scanAlias (cognitive 58) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2089— Lexer.scanAlias has cognitive complexity 58 (threshold 15). Drivers by points: if/else 20 (52 pts), match/switch 1 (3 pts), loops 2, boolean chains 1 (nesting depth added 34). 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.
SQLSelectQueryBlock.equals (cognitive 57) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:813— SQLSelectQueryBlock.equals has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 16 (31 pts), if/else 25, boolean chains 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.
OracleOutputVisitor.visit (cognitive 57) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1306— OracleOutputVisitor.visit has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 18 (37 pts), if/else 17 (18 pts), loops 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.
SchemaResolveVisitorFactory.resolve (cognitive 57) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1238— SchemaResolveVisitorFactory.resolve has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (53 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 33). 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.
WallVisitorUtils.getValue (cognitive 57) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1483— WallVisitorUtils.getValue has cognitive complexity 57 (threshold 15). Drivers by points: if/else 24 (50 pts), boolean chains 7 (nesting depth added 26). 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.
DruidDataSource.getConnectionDirect (cognitive 56) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1373— DruidDataSource.getConnectionDirect has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (50 pts), boolean chains 3, error handling 1 (2 pts), loops 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.
WallVisitorUtils.check (cognitive 56) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2165— WallVisitorUtils.check has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (47 pts), boolean chains 5, loops 1 (4 pts) (nesting depth added 29). 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.
OracleExprParser.parseDataType (cognitive 55) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:128— OracleExprParser.parseDataType has cognitive complexity 55 (threshold 15). Drivers by points: if/else 32 (52 pts), boolean chains 3 (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.
SQLASTOutputVisitor.visit (cognitive 55) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9213— SQLASTOutputVisitor.visit has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 11 (33 pts), if/else 14 (22 pts) (nesting depth added 30). 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.
WallVisitorUtils.checkUnion (cognitive 55) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2254— WallVisitorUtils.checkUnion has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 17, loops 4 (8 pts) (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.
CreateConnectionTask.runInternal (cognitive 54) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2586— CreateConnectionTask.runInternal has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (35 pts), error handling 5 (10 pts), boolean chains 8, loops 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.
MySqlShowColumnOutpuVisitor.visit (cognitive 54) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlShowColumnOutpuVisitor.java:36— MySqlShowColumnOutpuVisitor.visit has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (47 pts), loops 3 (6 pts), boolean chains 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.
SQLParserUtils.split (cognitive 54) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:693— SQLParserUtils.split has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (47 pts), boolean chains 6, loops 1 (nesting depth added 25). 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.
SQLASTOutputVisitor.visit (cognitive 54) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6875— SQLASTOutputVisitor.visit has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 14 (30 pts), if/else 19 (22 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.
SQLSelectQueryBlock.addWhereForDynamicFilter (cognitive 53) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:215— SQLSelectQueryBlock.addWhereForDynamicFilter has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (38 pts), loops 3 (14 pts), boolean chains 1 (nesting depth added 37). 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.
SQLSelectQueryBlock.equalsForMergeJoin (cognitive 53) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:924— SQLSelectQueryBlock.equalsForMergeJoin has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 14 (28 pts), if/else 24, 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.
MySqlStatementParser.parseLoadDataInFile (cognitive 53) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4330— MySqlStatementParser.parseLoadDataInFile has cognitive complexity 53 (threshold 15). Drivers by points: if/else 30 (52 pts), boolean chains 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.
PGSQLStatementParser.parseInsert (cognitive 53) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:99— PGSQLStatementParser.parseInsert has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (46 pts), loops 2 (7 pts) (nesting depth added 30). 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.
SQLExprParser.andRest (cognitive 53) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3527— SQLExprParser.andRest has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (43 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 31). 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.
DruidDataSourceStatLoggerImpl.log (cognitive 52) core/src/main/java/com/alibaba/druid/pool/DruidDataSourceStatLoggerImpl.java:84— DruidDataSourceStatLoggerImpl.log has cognitive complexity 52 (threshold 15). Drivers by points: if/else 32 (50 pts), loops 1 (2 pts) (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.
SQLPropertyExpr.computeDataType (cognitive 52) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLPropertyExpr.java:342— SQLPropertyExpr.computeDataType has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 2 (7 pts) (nesting depth added 32). 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.
ImpalaCreateTableParser.parseCreateTableRest (cognitive 52) core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:32— ImpalaCreateTableParser.parseCreateTableRest has cognitive complexity 52 (threshold 15). Drivers by points: if/else 29 (44 pts), boolean chains 6, loops 1 (2 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.
OscarStatementParser.parseInsert (cognitive 52) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:97— OscarStatementParser.parseInsert has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (45 pts), loops 2 (7 pts) (nesting depth added 30). 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.
DruidDataSource.configFromPropertiesAfterInit (cognitive 51) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:217— DruidDataSource.configFromPropertiesAfterInit has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 8, ternaries 5 (7 pts), error handling 3 (6 pts), loops 3 (4 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.
SQLSelectQueryBlock.addWhere (cognitive 51) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:144— SQLSelectQueryBlock.addWhere has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 4 (16 pts), boolean chains 1 (nesting depth added 35). 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.
BigQueryLexer.scanAlias (cognitive 51) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:174— BigQueryLexer.scanAlias has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (42 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 2 (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.
MySqlExprParser.parseInterval (cognitive 51) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1626— MySqlExprParser.parseInterval has cognitive complexity 51 (threshold 15). Drivers by points: if/else 29 (50 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.
TDOutputVisitor.printSqlSetQuantifier (cognitive 51) core/src/main/java/com/alibaba/druid/sql/dialect/teradata/visitor/TDOutputVisitor.java:35— TDOutputVisitor.printSqlSetQuantifier has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 9 (31 pts), if/else 9 (17 pts), boolean chains 3 (nesting depth added 30). 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.
Lexer.scanString2_d (cognitive 51) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1902— Lexer.scanString2_d has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (47 pts), boolean chains 2, loops 2 (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.
SQLEvalVisitorUtils.visit (cognitive 51) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:958— SQLEvalVisitorUtils.visit has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (39 pts), boolean chains 8, match/switch 2 (4 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.
CreateConnectionThread.run (cognitive 50) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2743— CreateConnectionThread.run has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (27 pts), error handling 6 (14 pts), boolean chains 8, loops 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.
GaussDbOutputVisitor.visit (cognitive 50) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:197— GaussDbOutputVisitor.visit has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (26 pts), ternaries 7 (24 pts) (nesting depth added 29). 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.
MySqlLexer.skipFirstHintsOrMultiCommentAndNextToken (cognitive 50) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:644— MySqlLexer.skipFirstHintsOrMultiCommentAndNextToken has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (40 pts), boolean chains 9, loops 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.
MySqlSelectParser.parseTableSourceRest (cognitive 50) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:683— MySqlSelectParser.parseTableSourceRest has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (40 pts), boolean chains 5, match/switch 1 (5 pts) (nesting depth added 27). 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.
SQLStatementParser.parseTruncate (cognitive 50) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3674— SQLStatementParser.parseTruncate has cognitive complexity 50 (threshold 15). Drivers by points: if/else 23 (42 pts), loops 4 (8 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.
SQLASTOutputVisitor.visit (cognitive 50) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6565— SQLASTOutputVisitor.visit has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 14 (32 pts), if/else 13 (18 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.
SchemaStatVisitor.visit (cognitive 50) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1747— SchemaStatVisitor.visit has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (47 pts), boolean chains 3 (nesting depth added 28). 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.
SQLCreateTableStatement.sort (cognitive 49) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:772— SQLCreateTableStatement.sort has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (32 pts), loops 9 (17 pts) (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.
MySqlExprParser.parsePartition (cognitive 49) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2385— MySqlExprParser.parsePartition has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (43 pts), boolean chains 3, loops 2 (3 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.
MySqlStatementParser.parseFlush (cognitive 49) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2194— MySqlStatementParser.parseFlush has cognitive complexity 49 (threshold 15). Drivers by points: if/else 27 (40 pts), loops 3 (7 pts), boolean chains 2 (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.
MySqlOutputVisitor.visit (cognitive 49) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2223— MySqlOutputVisitor.visit has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 13 (25 pts), if/else 17 (19 pts), loops 2 (3 pts), boolean chains 2 (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.
OscarOutputVisitor.visit (cognitive 49) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2280— OscarOutputVisitor.visit has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 13 (27 pts), if/else 14 (19 pts), loops 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.
PGSelectParser.parseTableSourceTableSample (cognitive 49) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:327— PGSelectParser.parseTableSourceTableSample has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (39 pts), boolean chains 5, match/switch 1 (5 pts) (nesting depth added 27). 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.
PGOutputVisitor.visit (cognitive 49) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2773— PGOutputVisitor.visit has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 13 (27 pts), if/else 14 (19 pts), loops 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.
SQLExprParser.parseSelectOrderByItem (cognitive 49) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2996— SQLExprParser.parseSelectOrderByItem has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (45 pts), boolean chains 2, loops 1 (2 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.
BigQueryLexer.scanString (cognitive 48) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:341— BigQueryLexer.scanString has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (39 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 2 (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.
MySqlStatementParser.parseSet (cognitive 48) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4895— MySqlStatementParser.parseSet has cognitive complexity 48 (threshold 15). Drivers by points: if/else 30 (48 pts) (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.
OracleStatementParser.parseCreatePackage (cognitive 48) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2891— OracleStatementParser.parseCreatePackage has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (42 pts), loops 2 (6 pts) (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.
SQLStatementParser.parseCreateMaterializedView (cognitive 48) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4345— SQLStatementParser.parseCreateMaterializedView has cognitive complexity 48 (threshold 15). Drivers by points: if/else 26 (41 pts), loops 2 (4 pts), boolean chains 3 (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.
SQLStatementParser.parseCreateView (cognitive 48) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5002— SQLStatementParser.parseCreateView has cognitive complexity 48 (threshold 15). Drivers by points: if/else 25 (43 pts), boolean chains 3, loops 1 (2 pts) (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.
SQLStatementParser.parseDrop (cognitive 48) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:841— SQLStatementParser.parseDrop has cognitive complexity 48 (threshold 15). Drivers by points: if/else 29 (41 pts), boolean chains 3, loops 1 (3 pts), match/switch 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.
SQLStatementParser.parseStatementListNonStandard (cognitive 48) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:512— SQLStatementParser.parseStatementListNonStandard has cognitive complexity 48 (threshold 15). Drivers by points: if/else 36 (41 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 6). 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.
ParameterizedOutputVisitorUtils.parameterize (cognitive 48) core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:155— ParameterizedOutputVisitorUtils.parameterize has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (39 pts), loops 3 (7 pts), boolean chains 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.
DruidStatManagerFacade.mergeWallStat (cognitive 48) core/src/main/java/com/alibaba/druid/stat/DruidStatManagerFacade.java:211— DruidStatManagerFacade.mergeWallStat has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (28 pts), loops 4 (10 pts), boolean chains 7, ternaries 1 (3 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.
OracleOutputVisitor.visit (cognitive 47) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1613— OracleOutputVisitor.visit has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 14 (28 pts), if/else 18 (19 pts) (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.
OscarOutputVisitor.visit (cognitive 47) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1186— OscarOutputVisitor.visit has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 12 (25 pts), if/else 19 (21 pts), boolean chains 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.
SQLExprParser.notRationalRest (cognitive 47) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4119— SQLExprParser.notRationalRest has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (38 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 28). 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.
SQLStatementParser.parseGrant (cognitive 47) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1566— SQLStatementParser.parseGrant has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (39 pts), loops 2 (4 pts), boolean chains 2, match/switch 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.
SQLASTOutputVisitor.visit (cognitive 47) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4531— SQLASTOutputVisitor.visit has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (32 pts), ternaries 5 (12 pts), boolean chains 3 (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.
CalciteMySqlNodeVisitor.visit (cognitive 47) core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java:480— CalciteMySqlNodeVisitor.visit has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 3 (7 pts), boolean chains 5 (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.
DB2ExprParser.primaryRest (cognitive 46) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:63— DB2ExprParser.primaryRest has cognitive complexity 46 (threshold 15). Drivers by points: if/else 26 (44 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.
MySqlSelectQueryBlock.accept0 (cognitive 46) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:249— MySqlSelectQueryBlock.accept0 has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (32 pts), loops 5 (14 pts) (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.
MySqlCreateTableParser.parsePartitionBy (cognitive 46) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1032— MySqlCreateTableParser.parsePartitionBy has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (37 pts), loops 3 (8 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.
SQLParser.as (cognitive 46) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:478— SQLParser.as has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (36 pts), boolean chains 4, loops 1 (3 pts), match/switch 2 (3 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.
SQLASTOutputVisitor.visitStatementList (cognitive 46) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11950— SQLASTOutputVisitor.visitStatementList has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 4 (12 pts), boolean chains 1 (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.
SQLEvalVisitorUtils.div (cognitive 46) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1597— SQLEvalVisitorUtils.div has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 12, 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.
WallVisitorUtils.checkSelectForMultiTenant (cognitive 46) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:425— WallVisitorUtils.checkSelectForMultiTenant has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 4 (nesting depth added 23). 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.
SQLDateExpr.check (cognitive 45) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:160— SQLDateExpr.check has cognitive complexity 45 (threshold 15). Drivers by points: if/else 28 (43 pts), boolean chains 1, match/switch 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.
SQLTimestampNTZExpr.check (cognitive 45) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:186— SQLTimestampNTZExpr.check has cognitive complexity 45 (threshold 15). Drivers by points: if/else 28 (43 pts), boolean chains 1, match/switch 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.
MySqlLexer.scanString (cognitive 45) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:488— MySqlLexer.scanString has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (40 pts), match/switch 1 (3 pts), loops 2 (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.
OracleOutputVisitor.visit (cognitive 45) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2276— OracleOutputVisitor.visit has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 12 (28 pts), if/else 14 (17 pts) (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.
OscarOutputVisitor.visit (cognitive 45) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:271— OscarOutputVisitor.visit has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 9 (23 pts), if/else 11 (17 pts), boolean chains 5 (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.
MySqlExprParser.parseColumnRest (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1784— MySqlExprParser.parseColumnRest has cognitive complexity 44 (threshold 15). Drivers by points: if/else 31 (39 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). 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.
MySqlStatementParser.parseAlterDrop (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7640— MySqlStatementParser.parseAlterDrop has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (39 pts), loops 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.
MySqlStatementParser.parseCreateUser (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:776— MySqlStatementParser.parseCreateUser has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (41 pts), boolean chains 2, loops 1 (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.
MySqlStatementParser.parseDeleteStatement (cognitive 44) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:137— MySqlStatementParser.parseDeleteStatement has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (42 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.
SQLExprParser.primaryRest (cognitive 44) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1590— SQLExprParser.primaryRest has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 5, loops 1 (2 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.
SQLSelectParser.parseTableSourceSampleHive (cognitive 44) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1522— SQLSelectParser.parseTableSourceSampleHive has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (34 pts), boolean chains 5, match/switch 1 (5 pts) (nesting depth added 26). 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.
ExportParameterVisitorUtils.exportParameter (cognitive 44) core/src/main/java/com/alibaba/druid/sql/visitor/ExportParameterVisitorUtils.java:80— ExportParameterVisitorUtils.exportParameter has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (38 pts), loops 2 (6 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.
SQLUtils._normalize (cognitive 44) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1953— SQLUtils._normalize has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (38 pts), boolean chains 6 (nesting depth added 25). 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.
MySqlStatementParser.alterView (cognitive 43) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5200— MySqlStatementParser.alterView has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (39 pts), boolean chains 2, loops 1 (2 pts) (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.
OracleSelectParser.parseTableSourceRest (cognitive 43) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:808— OracleSelectParser.parseTableSourceRest has cognitive complexity 43 (threshold 15). Drivers by points: if/else 27 (39 pts), boolean chains 4 (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.
PGExprParser.primaryRest (cognitive 43) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:422— PGExprParser.primaryRest has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (35 pts), boolean chains 5, match/switch 1 (3 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.
SQLServerLexer.scanComment (cognitive 43) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:77— SQLServerLexer.scanComment has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 6, loops 3 (6 pts) (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.
SQLASTOutputVisitor.printFetchFirst (cognitive 43) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2765— SQLASTOutputVisitor.printFetchFirst has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 6 (21 pts), if/else 10 (19 pts), boolean chains 3 (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.
SQLASTOutputVisitor.printMethodParameters (cognitive 43) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1916— SQLASTOutputVisitor.printMethodParameters has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 5, loops 1 (nesting depth added 22). 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.
SQLUtils.toSQLString (cognitive 43) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:438— SQLUtils.toSQLString has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 3 (9 pts), boolean chains 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.
DruidDataSource.recycle (cognitive 42) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1901— DruidDataSource.recycle has cognitive complexity 42 (threshold 15). Drivers by points: if/else 25 (36 pts), boolean chains 5, error handling 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.
SQLBinaryOpExpr.computeDataType (cognitive 42) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:565— SQLBinaryOpExpr.computeDataType has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 8, match/switch 1 (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.
DB2ExprParser.parseIdentity (cognitive 42) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2ExprParser.java:213— DB2ExprParser.parseIdentity has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (42 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.
H2ExprParser.parseIdentity0 (cognitive 42) core/src/main/java/com/alibaba/druid/sql/dialect/h2/parser/H2ExprParser.java:94— H2ExprParser.parseIdentity0 has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (42 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.
OdpsLexer.scanIdentifier (cognitive 42) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsLexer.java:144— OdpsLexer.scanIdentifier has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 6, loops 3 (5 pts) (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.
OracleLexer.scanComment (cognitive 42) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:253— OracleLexer.scanComment has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 3 (6 pts), boolean chains 4, ternaries 1 (2 pts) (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.
OscarOutputVisitor.visit (cognitive 42) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:90— OscarOutputVisitor.visit has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (24 pts), ternaries 7 (14 pts), boolean chains 4 (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.
SnowflakeCreateTableParser.parseCreateTableRest (cognitive 42) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeCreateTableParser.java:59— SnowflakeCreateTableParser.parseCreateTableRest has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (38 pts), loops 2 (4 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.
SQLStatementParser.parseCreate (cognitive 42) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4096— SQLStatementParser.parseCreate has cognitive complexity 42 (threshold 15). Drivers by points: if/else 28 (39 pts), boolean chains 2, match/switch 1 (nesting depth added 11). 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.
SQLStatementParser.parseHiveInsertStmt (cognitive 42) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6934— SQLStatementParser.parseHiveInsertStmt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 5, loops 2 (4 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.
FnvHash.hashCode64 (cognitive 42) core/src/main/java/com/alibaba/druid/util/FnvHash.java:289— FnvHash.hashCode64 has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 12, ternaries 4 (8 pts), loops 2 (4 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.
SQLBinaryOpExpr.split (cognitive 41) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:301— SQLBinaryOpExpr.split has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (39 pts), loops 2 (nesting depth added 20). 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.
OracleOutputVisitor.visit (cognitive 41) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1722— OracleOutputVisitor.visit has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 15 (29 pts), if/else 12 (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.
SQLServerStatementParser.parseDeclare (cognitive 41) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:193— SQLServerStatementParser.parseDeclare has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (34 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 23). 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.
SQLExprParser.primaryIdentifier (cognitive 41) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:939— SQLExprParser.primaryIdentifier has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 18, ternaries 1 (2 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.
SQLASTOutputVisitor.printInteger (cognitive 41) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1807— SQLASTOutputVisitor.printInteger has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (35 pts), boolean chains 6 (nesting depth added 19). 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.
SchemaStatVisitor.handleCondition (cognitive 41) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:764— SchemaStatVisitor.handleCondition has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 5, loops 3 (5 pts), 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.
SchemaStatVisitor.visit (cognitive 41) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1213— SchemaStatVisitor.visit has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (25 pts), loops 7 (12 pts), boolean chains 4 (nesting depth added 11). 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.
MySqlStatementParser.parseExplain (cognitive 40) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:2381— MySqlStatementParser.parseExplain has cognitive complexity 40 (threshold 15). Drivers by points: if/else 23 (36 pts), loops 1 (3 pts), match/switch 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.
OracleSelectParser.select (cognitive 40) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:42— OracleSelectParser.select has cognitive complexity 40 (threshold 15). Drivers by points: if/else 26 (38 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.
OracleOutputVisitor.printCreateFunctionBody (cognitive 40) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2059— OracleOutputVisitor.printCreateFunctionBody has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 9 (20 pts), if/else 14 (18 pts), boolean chains 2 (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.
OscarExprParser.primaryRest (cognitive 40) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:234— OscarExprParser.primaryRest has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 4, match/switch 1 (3 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.
Lexer.scanIdentifier (cognitive 40) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2585— Lexer.scanIdentifier has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 9, ternaries 3 (6 pts), loops 2 (3 pts), match/switch 1 (2 pts) (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. This shape REPEATS in the file: one other method here (Lexer.scanIdentifier0) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Lexer.scanIdentifier0 (cognitive 40) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2721— Lexer.scanIdentifier0 has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 9, ternaries 3 (6 pts), loops 2 (3 pts), match/switch 1 (2 pts) (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. This shape REPEATS in the file: one other method here (Lexer.scanIdentifier) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SQLExprParser.expr (cognitive 40) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:85— SQLExprParser.expr has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 10 (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.
SQLSelectParser.parsePivot (cognitive 40) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2431— SQLSelectParser.parsePivot has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (32 pts), loops 3 (8 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.
SQLASTOutputVisitor.visit (cognitive 40) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7978— SQLASTOutputVisitor.visit has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 5 (14 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 21). 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.
NameResolveVisitor.visit (cognitive 39) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/transform/NameResolveVisitor.java:32— NameResolveVisitor.visit has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (32 pts), boolean chains 6, loops 1 (nesting depth added 19). 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.
OscarOutputVisitor.visit (cognitive 39) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1668— OscarOutputVisitor.visit has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 12 (24 pts), if/else 15 (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.
PGOutputVisitor.visit (cognitive 39) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2058— PGOutputVisitor.visit has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 12 (24 pts), if/else 15 (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.
RedshiftCreateTableParser.parseCreateTableRest (cognitive 39) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftCreateTableParser.java:52— RedshiftCreateTableParser.parseCreateTableRest has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 21). 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.
SQLExprParser.orRest (cognitive 39) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3642— SQLExprParser.orRest has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 22). 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.
SQLMethodInvokeExpr.computeDataType (cognitive 38) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLMethodInvokeExpr.java:455— SQLMethodInvokeExpr.computeDataType has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 9 (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.
MySqlOutputVisitor.visit (cognitive 38) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3448— MySqlOutputVisitor.visit has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 9 (16 pts), loops 3 (4 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.
StarRocksOutputVisitor.printDistributedBy (cognitive 38) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:137— StarRocksOutputVisitor.printDistributedBy has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 5 (21 pts), if/else 7 (16 pts), boolean chains 1 (nesting depth added 25). 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.
SQLParserUtils.removeComment (cognitive 38) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:1036— SQLParserUtils.removeComment has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 7, loops 3 (6 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.
SQLSelectParser.parseWhere (cognitive 38) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:684— SQLSelectParser.parseWhere has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (25 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (3 pts), match/switch 1 (3 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.
SQLStatementParser.alterMaterialized (cognitive 38) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7587— SQLStatementParser.alterMaterialized has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (33 pts), loops 2 (4 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.
SchemaRepository.console (cognitive 38) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:465— SchemaRepository.console has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 3 (8 pts), error handling 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.
SqlTypeUDF.getStmtSqlType (cognitive 38) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlTypeUDF.java:79— SqlTypeUDF.getStmtSqlType has cognitive complexity 38 (threshold 15). Drivers by points: if/else 26 (29 pts), ternaries 3 (8 pts), boolean chains 1 (nesting depth added 8). 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.
WallVisitorUtils.isWhereOrHaving (cognitive 38) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1258— WallVisitorUtils.isWhereOrHaving has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 1, loops 1 (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.
AthenaCreateTableParser.parseCreateTableRest (cognitive 37) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:28— AthenaCreateTableParser.parseCreateTableRest has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 2 (4 pts), boolean chains 3 (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.
DB2SelectParser.query (cognitive 37) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2SelectParser.java:51— DB2SelectParser.query has cognitive complexity 37 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 1, loops 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.
Lexer.scanString2 (cognitive 37) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1799— Lexer.scanString2 has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (35 pts), loops 2 (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.
SQLSelectParser.parseGroupByItem (cognitive 37) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1065— SQLSelectParser.parseGroupByItem has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 1 (3 pts) (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.
SQLASTOutputVisitor.printMethodParameters (cognitive 37) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1983— SQLASTOutputVisitor.printMethodParameters has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 7 (19 pts), if/else 12 (17 pts), boolean chains 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.
WallVisitorUtils.check (cognitive 37) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:69— WallVisitorUtils.check has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 23). 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.
MySqlExprParser.parseSubPartition (cognitive 36) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2316— MySqlExprParser.parseSubPartition has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 2, loops 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.
MySqlStatementParser.parseCreateTableSpace (cognitive 36) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:604— MySqlStatementParser.parseCreateTableSpace has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (35 pts), 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.
OdpsStatementParser.parsePrivilege (cognitive 36) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1421— OdpsStatementParser.parsePrivilege has cognitive complexity 36 (threshold 15). Drivers by points: if/else 25 (32 pts), loops 2 (4 pts) (nesting depth added 9). 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.
OracleExprParser.parseLobStorage (cognitive 36) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1482— OracleExprParser.parseLobStorage has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 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.
PGOutputVisitor.printOnConflict (cognitive 36) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:298— PGOutputVisitor.printOnConflict has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 7 (13 pts), boolean chains 5 (nesting depth added 18). 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.
SchemaResolveVisitorFactory.resolve (cognitive 36) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2013— SchemaResolveVisitorFactory.resolve has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 4 (10 pts) (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.
SQLASTOutputVisitor.visit (cognitive 36) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5984— SQLASTOutputVisitor.visit has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 13, boolean chains 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.
WallVisitorUtils.getValue (cognitive 36) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:989— WallVisitorUtils.getValue has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 7, match/switch 2 (7 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.
SQLSelect.equals (cognitive 35) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelect.java:349— SQLSelect.equals has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 11 (21 pts), if/else 13, 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.
OracleExprParser.parseInterval (cognitive 35) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:994— OracleExprParser.parseInterval has cognitive complexity 35 (threshold 15). Drivers by points: if/else 23 (33 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.
SnowflakeStatementParser.parseShow (cognitive 35) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:328— SnowflakeStatementParser.parseShow has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (29 pts), boolean chains 6 (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.
Substring.eval (cognitive 35) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Substring.java:93— Substring.eval has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 6, loops 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.
SQLASTOutputVisitor.visit (cognitive 35) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10018— SQLASTOutputVisitor.visit has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 9 (22 pts), if/else 11 (13 pts) (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.
WallFilter.preprocessResultSet (cognitive 35) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:1586— WallFilter.preprocessResultSet has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 5, 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.
MySqlCreateTableParser.parseConstraint (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1524— MySqlCreateTableParser.parseConstraint has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (33 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.
MySqlExprParser.parseJsonTableColumn (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1288— MySqlExprParser.parseJsonTableColumn has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (5 pts), boolean chains 3 (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.
MySqlStatementParser.parseReplace (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4135— MySqlStatementParser.parseReplace has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (27 pts), loops 4 (6 pts), boolean chains 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.
OdpsExprParser.parseSelectItem (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:434— OdpsExprParser.parseSelectItem has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 7, loops 1 (3 pts) (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.
OdpsOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:246— OdpsOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 6 (15 pts), boolean chains 2 (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.
OracleCreateTableParser.parseCreateTableSupplementalLoggingProps (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleCreateTableParser.java:545— OracleCreateTableParser.parseCreateTableSupplementalLoggingProps has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 2 (4 pts) (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.
OracleExprParser.parseOpaque (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1382— OracleExprParser.parseOpaque has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 1 (2 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.
PGOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2985— PGOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 11 (12 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.
RedshiftOutputVisitor.visit (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/visitor/RedshiftOutputVisitor.java:77— RedshiftOutputVisitor.visit has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 9 (22 pts), if/else 10 (12 pts) (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.
SQLServerStatementParser.parseSet (cognitive 34) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:393— SQLServerStatementParser.parseSet has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23 (33 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.
SQLExprParser.dotRest (cognitive 34) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2065— SQLExprParser.dotRest has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 4 (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.
SQLStatementParser.alterSequence (cognitive 34) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7356— SQLStatementParser.alterSequence has cognitive complexity 34 (threshold 15). Drivers by points: if/else 22 (30 pts), boolean chains 3, 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.
WebURIStat.afterInvoke (cognitive 34) core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:175— WebURIStat.afterInvoke has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 4 (7 pts) (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.
CodeStatVisitor.preVisit (cognitive 34) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlCodeStat.java:166— CodeStatVisitor.preVisit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (31 pts), loops 1 (3 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.
DruidAbstractDataSource.validateConnection (cognitive 33) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1434— DruidAbstractDataSource.validateConnection has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), error handling 4 (8 pts), ternaries 1 (3 pts), boolean chains 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.
DmOutputVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:72— DmOutputVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16, ternaries 8 (15 pts), boolean chains 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.
HiveOutputVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:61— HiveOutputVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 4 (11 pts), loops 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.
MySqlOutputVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4663— MySqlOutputVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 11 (13 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.
OracleOutputVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:347— OracleOutputVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 12 (14 pts), boolean chains 1 (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.
PGOutputVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:105— PGOutputVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 5 (10 pts), boolean chains 4 (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.
SQLServerOutputVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:712— SQLServerOutputVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 6 (13 pts), loops 2 (4 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.
SQLParserUtils.getTables (cognitive 33) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:1115— SQLParserUtils.getTables has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (27 pts), match/switch 2 (3 pts), boolean chains 2, loops 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.
SQLStatementParser.parseCreateSequence (cognitive 33) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4728— SQLStatementParser.parseCreateSequence has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 3, loops 1 (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.
OracleUnorderedLimitDetectVisitor.visit (cognitive 33) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:719— OracleUnorderedLimitDetectVisitor.visit has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 4, loops 1 (2 pts) (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.
WallVisitorUtils.preVisitCheck (cognitive 33) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2534— WallVisitorUtils.preVisitCheck has cognitive complexity 33 (threshold 15). Drivers by points: if/else 28, boolean chains 5. 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.
SQLBinaryOpExpr.merge (cognitive 32) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:694— SQLBinaryOpExpr.merge has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 3, loops 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.
SQLSelectQueryBlock.cloneTo (cognitive 32) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1033— SQLSelectQueryBlock.cloneTo has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (23 pts), loops 5 (9 pts) (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.
DmExprParser.parseInterval (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:100— DmExprParser.parseInterval has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (30 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.
MySqlInsertStatement.accept0 (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlInsertStatement.java:133— MySqlInsertStatement.accept0 has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 3 (9 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.
MySqlExprParser.parseAssignItem (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:2005— MySqlExprParser.parseAssignItem has cognitive complexity 32 (threshold 15). Drivers by points: if/else 22 (28 pts), ternaries 1 (3 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.
MySqlSelectIntoParser.parseInto (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:206— MySqlSelectIntoParser.parseInto has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (31 pts), boolean chains 1 (nesting depth added 20). 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.
MySqlSelectParser.parseInto (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:573— MySqlSelectParser.parseInto has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 1 (2 pts), boolean chains 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.
MySqlOutputVisitor.visit (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4921— MySqlOutputVisitor.visit has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 10 (21 pts), if/else 8 (11 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.
OracleStatementParser.parseAlterTableSplit (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1814— OracleStatementParser.parseAlterTableSplit has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 2 (7 pts) (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.
OracleStatementParser.parseFunction (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:989— OracleStatementParser.parseFunction has cognitive complexity 32 (threshold 15). Drivers by points: if/else 26 (31 pts), boolean chains 1 (nesting depth added 5). 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.
OscarExprParser.parseInterval (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:152— OscarExprParser.parseInterval has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (30 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.
SQLServerSelectParser.select (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:39— SQLServerSelectParser.select has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (28 pts), loops 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.
SQLServerStatementParser.parseStatementListDialect (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:50— SQLServerStatementParser.parseStatementListDialect has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 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.
StarRocksOutputVisitor.visit (cognitive 32) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:253— StarRocksOutputVisitor.visit has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 12 (14 pts), boolean chains 2, loops 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.
Lexer.nextTokenValue (cognitive 32) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:509— Lexer.nextTokenValue has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 11, loops 1 (nesting depth added 4). 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.
SQLStatementParser.alterTableAfterName (cognitive 32) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2265— SQLStatementParser.alterTableAfterName has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 2, match/switch 1 (2 pts), 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.
SQLStatementParser.parseInsert0 (cognitive 32) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3855— SQLStatementParser.parseInsert0 has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 4, loops 2 (4 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.
SchemaResolveVisitorFactory.checkParameter (cognitive 32) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2238— SchemaResolveVisitorFactory.checkParameter has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 1, loops 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.
ParameterizedOutputVisitorUtils.parameterizeHash (cognitive 32) core/src/main/java/com/alibaba/druid/sql/visitor/ParameterizedOutputVisitorUtils.java:264— ParameterizedOutputVisitorUtils.parameterizeHash has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 1, ternaries 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.
SQLASTOutputVisitor.printName (cognitive 32) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1474— SQLASTOutputVisitor.printName has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 18). 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.
SQLEvalVisitorUtils.add (cognitive 32) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1898— SQLEvalVisitorUtils.add has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 13 (nesting depth added 2). 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.
SQLEvalVisitorUtils.eq (cognitive 32) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1826— SQLEvalVisitorUtils.eq has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 13 (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.
PagerUtils.limitOracle (cognitive 32) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:372— PagerUtils.limitOracle has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 4 (nesting depth added 18). 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.
WallVisitorUtils.check (cognitive 32) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2660— WallVisitorUtils.check has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 4, loops 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.
DruidConnectionHolder.<init> (cognitive 31) core/src/main/java/com/alibaba/druid/pool/DruidConnectionHolder.java:108— DruidConnectionHolder.<init> has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 5 (9 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.
DB2OutputVisitor.visit (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2OutputVisitor.java:215— DB2OutputVisitor.visit has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 6 (11 pts), boolean chains 5 (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.
HiveExprParser.parseSelectItemRest (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:119— HiveExprParser.parseSelectItemRest has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 9 (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.
MySqlStatementParser.parseFullTextAnalyzer (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:398— MySqlStatementParser.parseFullTextAnalyzer has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (9 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.
MySqlOutputVisitor.visit (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5463— MySqlOutputVisitor.visit has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 9 (11 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.
OracleOutputVisitor.visit (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2441— OracleOutputVisitor.visit has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 8 (19 pts), if/else 7 (12 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.
OracleSchemaStatVisitor.visit (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleSchemaStatVisitor.java:572— OracleSchemaStatVisitor.visit has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (10 pts) (nesting depth added 20). 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.
OscarOutputVisitor.visit (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1370— OscarOutputVisitor.visit has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 8 (19 pts), if/else 7 (12 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.
PGOutputVisitor.visit (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1747— PGOutputVisitor.visit has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 8 (19 pts), if/else 7 (12 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.
SQLServerOutputVisitor.visit (cognitive 31) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:656— SQLServerOutputVisitor.visit has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 11 (13 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.
SQLExprParser.primary (cognitive 31) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:464— SQLExprParser.primary has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 3, match/switch 2 (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.
SQLASTOutputVisitor.printDataType (cognitive 31) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1325— SQLASTOutputVisitor.printDataType has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 4 (14 pts), loops 1 (2 pts) (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.
SQLASTOutputVisitor.printParameter (cognitive 31) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3298— SQLASTOutputVisitor.printParameter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19, ternaries 3 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). 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.
SQLASTOutputVisitor.visit (cognitive 31) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3406— SQLASTOutputVisitor.visit has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 12, 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.
SQLASTOutputVisitor.visitorBinaryRight (cognitive 31) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:878— SQLASTOutputVisitor.visitorBinaryRight has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 5 (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.
DruidStatService.service (cognitive 31) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:78— DruidStatService.service has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19, boolean chains 6, ternaries 3 (6 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.
MySqlUtils.isNumber (cognitive 31) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:820— MySqlUtils.isNumber has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 6, loops 1 (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.
WallFilter.wallUpdateCheck (cognitive 31) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:749— WallFilter.wallUpdateCheck has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 2 (5 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.
SQLSelectQueryBlock.resolveColum (cognitive 30) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1427— SQLSelectQueryBlock.resolveColum has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 18). 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.
GaussDbOutputVisitor.visit (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:339— GaussDbOutputVisitor.visit has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 6 (10 pts), loops 2 (4 pts) (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.
HiveOutputVisitor.visit (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:384— HiveOutputVisitor.visit has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (21 pts), if/else 9 (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.
MySqlSelectIntoParser.query (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectIntoParser.java:62— MySqlSelectIntoParser.query has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (30 pts) (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.
OdpsOutputVisitor.visit (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:650— OdpsOutputVisitor.visit has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 8 (12 pts), loops 1 (2 pts) (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.
OracleExprParser.parseSegmentAttributes (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1927— OracleExprParser.parseSegmentAttributes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 3, loops 1 (nesting depth added 6). 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.
OracleExprParser.primary (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:305— OracleExprParser.primary has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 14). 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.
OracleStatementParser.parseCreateType (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:3061— OracleStatementParser.parseCreateType has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 1, loops 1 (nesting depth added 6). 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.
OracleRowNumToLimit.visit (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:40— OracleRowNumToLimit.visit has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 4, loops 2 (4 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.
SnowflakeSelectParser.parseTableSourceRest (cognitive 30) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeSelectParser.java:113— SnowflakeSelectParser.parseTableSourceRest has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 2 (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.
Lexer.scanMultiLineComment (cognitive 30) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2476— Lexer.scanMultiLineComment has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 6, loops 2 (4 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.
SQLParser.tableAliasFromOptionalKeyword (cognitive 30) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:230— SQLParser.tableAliasFromOptionalKeyword has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 5 (11 pts), boolean chains 2 (nesting depth added 15). 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.
SQLStatementParser.parseDropTable (cognitive 30) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3311— SQLStatementParser.parseDropTable has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 3, loops 2 (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.
SQLASTOutputVisitor.printSelectList (cognitive 30) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:566— SQLASTOutputVisitor.printSelectList has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 5, loops 1 (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.
SQLASTOutputVisitor.visit (cognitive 30) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:6814— SQLASTOutputVisitor.visit has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 10, loops 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.
SQLEvalVisitorUtils.sub (cognitive 30) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1969— SQLEvalVisitorUtils.sub has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 11 (nesting depth added 2). 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.
WallVisitorUtils.checkConditionForMultiTenant (cognitive 30) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:664— WallVisitorUtils.checkConditionForMultiTenant has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (29 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.
DruidDataSource.toString (cognitive 29) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:3354— DruidDataSource.toString has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (7 pts), error handling 1 (4 pts) (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.
SQLColumnDefinition.clone (cognitive 29) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLColumnDefinition.java:548— SQLColumnDefinition.clone has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20 (24 pts), loops 3 (5 pts) (nesting depth added 6). 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.
BigQueryOutputVisitor.visit (cognitive 29) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:280— BigQueryOutputVisitor.visit has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 6 (11 pts), 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.
CKOutputVisitor.visit (cognitive 29) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:420— CKOutputVisitor.visit has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (19 pts), if/else 10 (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.
MySqlUpdateStatement.accept0 (cognitive 29) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlUpdateStatement.java:57— MySqlUpdateStatement.accept0 has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (6 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.
MySqlOutputVisitor.visit (cognitive 29) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:661— MySqlOutputVisitor.visit has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 7 (13 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.
OracleLexer.scanVariable (cognitive 29) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:165— OracleLexer.scanVariable has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 5, 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.
Lexer.scanLineArgument (cognitive 29) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2424— Lexer.scanLineArgument has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, loops 3 (5 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.
SQLExprParser.parseAssignItem (cognitive 29) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5417— SQLExprParser.parseAssignItem has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 8 (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.
SQLExprParser.parseQueryPlanHint (cognitive 29) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3481— SQLExprParser.parseQueryPlanHint has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 4 (nesting depth added 15). 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.
SQLASTOutputVisitor.printInsertColumns (cognitive 29) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3820— SQLASTOutputVisitor.printInsertColumns has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 1 (2 pts), boolean chains 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.
SQLASTOutputVisitor.visit (cognitive 29) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10884— SQLASTOutputVisitor.visit has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (19 pts), if/else 10 (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.
FilterManager.loadFilter (cognitive 28) core/src/main/java/com/alibaba/druid/filter/FilterManager.java:99— FilterManager.loadFilter has cognitive complexity 28 (threshold 15). Drivers by points: error handling 6 (16 pts), if/else 6 (10 pts), loops 1 (2 pts) (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.
DruidDataSource.initExceptionSorter (cognitive 28) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1279— DruidDataSource.initExceptionSorter has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 4, 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.
SQLCreateTableStatement.findIndex (cognitive 28) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:645— SQLCreateTableStatement.findIndex has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (7 pts) (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.
BigQueryStatementParser.parseCreateFunction (cognitive 28) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:103— BigQueryStatementParser.parseCreateFunction has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 3, loops 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.
HiveOutputVisitor.visit (cognitive 28) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:161— HiveOutputVisitor.visit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 5 (10 pts), loops 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.
MySqlExprParser.primaryIdentifierRest (cognitive 28) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:172— MySqlExprParser.primaryIdentifierRest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 12 (nesting depth added 2). 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.
MySqlStatementParser.alterDatabase (cognitive 28) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8052— MySqlStatementParser.alterDatabase has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (25 pts), loops 1 (2 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.
OscarLexer.scanString (cognitive 28) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:99— OscarLexer.scanString has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 1 (3 pts), loops 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.
PGLexer.scanString (cognitive 28) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:103— PGLexer.scanString has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 1 (3 pts), loops 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.
RedshiftOutputVisitor.printInto (cognitive 28) core/src/main/java/com/alibaba/druid/sql/dialect/redshift/visitor/RedshiftOutputVisitor.java:53— RedshiftOutputVisitor.printInto has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 4 (15 pts), if/else 6 (13 pts) (nesting depth added 18). 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.
SQLExprParser.methodRest (cognitive 28) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2139— SQLExprParser.methodRest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (28 pts) (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.
SQLSelectParser.parseSelectList (cognitive 28) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1143— SQLSelectParser.parseSelectList has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 6, loops 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.
SchemaResolveVisitorFactory.resolve (cognitive 28) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1805— SchemaResolveVisitorFactory.resolve has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), error handling 1 (3 pts), loops 1 (2 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.
WallVisitorUtils.isSimpleConstExpr (cognitive 28) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:295— WallVisitorUtils.isSimpleConstExpr has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 3, loops 1 (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.
CKCreateTableParser.parseCreateTableRest (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKCreateTableParser.java:63— CKCreateTableParser.parseCreateTableRest has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 6, 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.
DorisOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/doris/visitor/DorisOutputVisitor.java:41— DorisOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 5 (12 pts), boolean chains 3 (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.
MySqlStatementParser.parseAnalyze (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:931— MySqlStatementParser.parseAnalyze has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 3 (6 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.
OracleOutputVisitor.printConstraintState (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1575— OracleOutputVisitor.printConstraintState has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 9 (11 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.
OracleOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2132— OracleOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 7 (9 pts) (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.
PGSQLStatementParser.parseSet (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1034— PGSQLStatementParser.parseSet has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 2 (4 pts), boolean chains 3 (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.
PGOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:74— PGOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (15 pts), if/else 8 (10 pts), loops 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.
SparkExprParser.primary (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:88— SparkExprParser.primary has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 1, match/switch 1 (nesting depth added 12). 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.
SQLServerOutputVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:380— SQLServerOutputVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 6 (10 pts), loops 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.
SQLStatementParser.parseHiveInsert (cognitive 27) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7049— SQLStatementParser.parseHiveInsert has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 2 (4 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.
SQLASTOutputVisitor.printOracleSegmentAttributes (cognitive 27) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9083— SQLASTOutputVisitor.printOracleSegmentAttributes has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 10 (11 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.
SQLEvalVisitorUtils.like (cognitive 27) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:2096— SQLEvalVisitorUtils.like has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, loops 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.
MySqlWallVisitor.visit (cognitive 27) core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:69— MySqlWallVisitor.visit has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (23 pts), boolean chains 4 (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.
ProxoolDataSource.populatePropertiesFromReference (cognitive 27) druid-wrapper/src/main/java/org/logicalcobwebs/proxool/ProxoolDataSource.java:275— ProxoolDataSource.populatePropertiesFromReference has cognitive complexity 27 (threshold 15). Drivers by points: if/else 25 (26 pts), loops 1 (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.
SQLDeleteStatement.removeCondition (cognitive 26) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:253— SQLDeleteStatement.removeCondition has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 14). 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.
SQLSelectItem.match (cognitive 26) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectItem.java:168— SQLSelectItem.match has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 13). 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.
SQLSelectQueryBlock.removeCondition (cognitive 26) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1496— SQLSelectQueryBlock.removeCondition has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 14). 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.
SQLUpdateStatement.removeCondition (cognitive 26) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:321— SQLUpdateStatement.removeCondition has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 14). 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.
DorisCreateTableParser.parsePartitionBy (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisCreateTableParser.java:20— DorisCreateTableParser.parsePartitionBy has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (5 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.
GaussDbCreateTableParser.parseCreateTableRest (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:55— GaussDbCreateTableParser.parseCreateTableRest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 2 (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.
MySqlSelectQueryBlock.equals (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:166— MySqlSelectQueryBlock.equals has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15, ternaries 5 (10 pts), boolean chains 1 (nesting depth added 5). 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.
OdpsOutputVisitor.visit (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:701— OdpsOutputVisitor.visit has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 9 (12 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.
OracleExprParser.parseConstraint (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1687— OracleExprParser.parseConstraint has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 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.
OracleOutputVisitor.visit (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:253— OracleOutputVisitor.visit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 3 (8 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.
PGCreateTableParser.parsePartitionBy (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:64— PGCreateTableParser.parsePartitionBy has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (6 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.
PGExprParser.primary (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:250— PGExprParser.primary has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 1 (2 pts), match/switch 1 (2 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.
SnowflakeStatementParser.parseCopyIntoOptions (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:209— SnowflakeStatementParser.parseCopyIntoOptions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (4 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.
SQLServerStatementParser.parseCreateFunctionBody (cognitive 26) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:884— SQLServerStatementParser.parseCreateFunctionBody has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 2 (4 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.
SQLStatementParser.parserParameters (cognitive 26) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3529— SQLStatementParser.parserParameters has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 4, loops 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.
SchemaRepository.findTable (cognitive 26) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:545— SchemaRepository.findTable has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 1 (3 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. This shape REPEATS in the file: one other method here (SchemaRepository.findView) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SchemaRepository.findView (cognitive 26) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:605— SchemaRepository.findView has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 1 (3 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. This shape REPEATS in the file: one other method here (SchemaRepository.findTable) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SQLEvalVisitorUtils.gt (cognitive 26) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1690— SQLEvalVisitorUtils.gt has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 10 (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.
PagerUtils.getLimit (cognitive 26) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:610— PagerUtils.getLimit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (22 pts), ternaries 1 (4 pts) (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.
JSONWriter.writeObject (cognitive 26) core/src/main/java/com/alibaba/druid/support/json/JSONWriter.java:57— JSONWriter.writeObject has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (22 pts), loops 2 (4 pts) (nesting depth added 6). 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.
WallVisitorUtils.checkInsertForMultiTenant (cognitive 26) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:566— WallVisitorUtils.checkInsertForMultiTenant has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 5). 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.
BlinkCreateTableParser.parseCreateTable (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/blink/parser/BlinkCreateTableParser.java:38— BlinkCreateTableParser.parseCreateTable has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 5, match/switch 1 (2 pts), 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.
GaussDbExprParser.parsePartitionValues (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:69— GaussDbExprParser.parsePartitionValues has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (25 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.
HiveOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:258— HiveOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (16 pts), if/else 8 (9 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.
ImpalaExprParser.parsePartition (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaExprParser.java:45— ImpalaExprParser.parsePartition has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 1 (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.
OracleExprParser.parsePartition (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1771— OracleExprParser.parsePartition has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 3 (5 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.
OracleStatementParser.parseExecute (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:858— OracleStatementParser.parseExecute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 1 (3 pts) (nesting depth added 15). 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.
OscarOutputVisitor.visit (cognitive 25) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1310— OscarOutputVisitor.visit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 7 (12 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.
SQLStatementParser.parseWithQuery (cognitive 25) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5912— SQLStatementParser.parseWithQuery has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), boolean chains 3, match/switch 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.
JdbcStatManager.getSqlList (cognitive 25) core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:279— JdbcStatManager.getSqlList has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 5 (8 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.
MonitorDaoJdbcImpl.load (cognitive 25) core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:214— MonitorDaoJdbcImpl.load has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (16 pts), loops 5 (6 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 4). 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.
WallVisitorUtils.checkJoinSelectForMultiTenant (cognitive 25) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:356— WallVisitorUtils.checkJoinSelectForMultiTenant has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 3 (nesting depth added 13). 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.
WallVisitorUtils.isFirstSelectTableSource (cognitive 25) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2001— WallVisitorUtils.isFirstSelectTableSource has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, loops 3 (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.
PreparedStatementProxyImpl.setObjectParameter (cognitive 24) core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:551— PreparedStatementProxyImpl.setObjectParameter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 23, boolean chains 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.
SQLCreateTableStatement.apply (cognitive 24) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1184— SQLCreateTableStatement.apply has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 3 (5 pts) (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.
BigQueryCreateTableParser.parseCreateTableRest (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryCreateTableParser.java:31— BigQueryCreateTableParser.parseCreateTableRest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (4 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.
DmOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:41— DmOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 7 (9 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.
ImpalaOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:74— ImpalaOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 9 (10 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.
MySqlExprParser.parseSelectItemIdentifier (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:846— MySqlExprParser.parseSelectItemIdentifier has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 5 (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.
MySqlOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1573— MySqlOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 7 (9 pts) (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.
OdpsStatementParser.parseGrant (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1340— OdpsStatementParser.parseGrant has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19 (24 pts) (nesting depth added 5). 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.
OracleExprParser.parseStorage (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1586— OracleExprParser.parseStorage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18 (23 pts), loops 1 (nesting depth added 5). 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.
OracleExprParser.relationalRest (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1085— OracleExprParser.relationalRest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 1 (3 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.
OracleLexer.scanNumber (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:352— OracleLexer.scanNumber has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, loops 3 (5 pts) (nesting depth added 4). 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.
OracleOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1407— OracleOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 6 (11 pts), 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.
OracleRowNumToLimit.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleRowNumToLimit.java:334— OracleRowNumToLimit.visit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 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.
PGSQLStatementParser.parseAlterColumn (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:951— PGSQLStatementParser.parseAlterColumn has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 3 (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.
PGSQLStatementParser.parseParameters (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:818— PGSQLStatementParser.parseParameters has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 3, 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.
SQLServerOutputVisitor.visit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:609— SQLServerOutputVisitor.visit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (11 pts), loops 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.
SQLExprParser.parseCharTypeRest (cognitive 24) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4727— SQLExprParser.parseCharTypeRest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (20 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.
SQLStatementParser.parseAlterDrop (cognitive 24) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3151— SQLStatementParser.parseAlterDrop has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 1 (2 pts), 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.
SQLStatementParser.parseCreateTrigger (cognitive 24) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4537— SQLStatementParser.parseCreateTrigger has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 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.
SQLStatementParser.parseDescribe (cognitive 24) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5835— SQLStatementParser.parseDescribe has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). 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.
SQLStatementParser.parseRevoke (cognitive 24) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1994— SQLStatementParser.parseRevoke has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, loops 1 (2 pts), match/switch 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.
SQLASTOutputVisitor.hiveVisit (cognitive 24) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9956— SQLASTOutputVisitor.hiveVisit has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 8 (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.
SQLASTOutputVisitor.printPartitionsCountAndSubPartitions (cognitive 24) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8264— SQLASTOutputVisitor.printPartitionsCountAndSubPartitions has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (14 pts), if/else 8 (10 pts) (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.
SQLEvalVisitorUtils.lt (cognitive 24) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1757— SQLEvalVisitorUtils.lt has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 8 (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.
IbatisUtils.set (cognitive 24) core/src/main/java/com/alibaba/druid/support/ibatis/IbatisUtils.java:113— IbatisUtils.set has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (2 pts) (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.
WallVisitorUtils.isSimpleCountTableSource (cognitive 24) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1615— WallVisitorUtils.isSimpleCountTableSource has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 1 (nesting depth added 13). 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.
LogFilter.resultSet_next (cognitive 23) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:632— LogFilter.resultSet_next has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 1 (3 pts), loops 1 (3 pts), boolean chains 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.
StatFilter.buildSlowParameters (cognitive 23) core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:564— StatFilter.buildSlowParameters has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (22 pts), loops 1 (nesting depth added 5). 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.
DruidAbstractDataSource.testConnectionInternal (cognitive 23) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1513— DruidAbstractDataSource.testConnectionInternal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 2, error handling 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.
DruidDataSource.removeAbandoned (cognitive 23) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2932— DruidDataSource.removeAbandoned has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (11 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.
SQLSelectQueryBlock.acceptChild (cognitive 23) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:738— SQLSelectQueryBlock.acceptChild has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (16 pts), loops 4 (7 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.
SQLSelectQueryBlock.getMappJoinTableSources (cognitive 23) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1659— SQLSelectQueryBlock.getMappJoinTableSources has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (6 pts) (nesting depth added 15). 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.
H2OutputVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:50— H2OutputVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (5 pts), ternaries 3 (5 pts) (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.
MySqlStatementParser.createTableRest (cognitive 23) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:268— MySqlStatementParser.createTableRest has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 2 (nesting depth added 5). 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.
OrderByResolve.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/transform/OrderByResolve.java:38— OrderByResolve.visit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (5 pts), boolean chains 1 (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.
OdpsOutputVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:397— OdpsOutputVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 9, boolean chains 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.
OracleUpdateStatement.equals (cognitive 23) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUpdateStatement.java:129— OracleUpdateStatement.equals has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 9, boolean chains 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.
PGSQLStatementParser.parseCreateIndex (cognitive 23) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1120— PGSQLStatementParser.parseCreateIndex has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 2 (3 pts), boolean chains 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.
Lexer.scanString (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1747— Lexer.scanString has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 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.
SQLExprParser.parseLimit (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:6340— SQLExprParser.parseLimit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, loops 1 (2 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.
SQLParser.printError (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:859— SQLParser.printError has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, loops 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.
SQLSelectParser.parseHierachical (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2240— SQLSelectParser.parseHierachical has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 6 (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.
SQLSelectParser.select (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:55— SQLSelectParser.select has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 3, 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.
SQLStatementParser.alterTableSet (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2628— SQLStatementParser.alterTableSet has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 1 (4 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.
SQLStatementParser.parseCreateDatabase (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4651— SQLStatementParser.parseCreateDatabase has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 1 (3 pts), boolean chains 2 (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.
SQLStatementParser.parseHiveCreateFunction (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7701— SQLStatementParser.parseHiveCreateFunction has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 3 (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.
SQLStatementParser.parseMergeWhen (cognitive 23) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5709— SQLStatementParser.parseMergeWhen has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 1 (2 pts), 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.
Schema.findTable (cognitive 23) core/src/main/java/com/alibaba/druid/sql/repository/Schema.java:156— Schema.findTable has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (23 pts) (nesting depth added 14). 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.
SchemaResolveVisitorFactory.resolve (cognitive 23) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:816— SchemaResolveVisitorFactory.resolve has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (4 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.
SQLEvalVisitorUtils.multi (cognitive 23) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:2041— SQLEvalVisitorUtils.multi has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 10 (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.
CalciteMySqlNodeVisitor.visit (cognitive 23) core/src/main/java/com/alibaba/druid/support/calcite/CalciteMySqlNodeVisitor.java:776— CalciteMySqlNodeVisitor.visit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 11). 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.
SqlTypeUDF.getSqlType (cognitive 23) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlTypeUDF.java:27— SqlTypeUDF.getSqlType has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18 (20 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). 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.
MySqlExceptionSorter.isExceptionFatal (cognitive 22) core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:27— MySqlExceptionSorter.isExceptionFatal has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 7, loops 1, match/switch 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.
DruidDataSource.handleFatalError (cognitive 22) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1814— DruidDataSource.handleFatalError has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, loops 1 (3 pts), ternaries 2 (nesting depth added 4). 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.
SQLSelectQueryBlock.hashCode (cognitive 22) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:896— SQLSelectQueryBlock.hashCode has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 22. 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.
DB2OutputVisitor.visit (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2OutputVisitor.java:82— DB2OutputVisitor.visit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 4 (10 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.
ImpalaOutputVisitor.visit (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:182— ImpalaOutputVisitor.visit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 3 (8 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.
MySqlExprParser.<init> (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:108— MySqlExprParser.<init> has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7 (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.
MySqlLexer.scanVariable (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:184— MySqlLexer.scanVariable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (6 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.
MySqlStatementParser.parseCreateEvent (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5570— MySqlStatementParser.parseCreateEvent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (21 pts), loops 1 (nesting depth added 5). 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.
OracleOutputVisitor.visit (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2785— OracleOutputVisitor.visit has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 7 (9 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.
OscarStatementParser.parseSet (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:514— OscarStatementParser.parseSet has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 5). 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.
PGSQLStatementParser.alterDatabase (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1355— PGSQLStatementParser.alterDatabase has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (22 pts) (nesting depth added 5). 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.
PGSQLStatementParser.parseBlock (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:729— PGSQLStatementParser.parseBlock has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 3, 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.
PGSQLStatementParser.parseCopy (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:607— PGSQLStatementParser.parseCopy has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (4 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.
PrestoStatementParser.parseAlterFunction (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:139— PrestoStatementParser.parseAlterFunction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 1 (2 pts) (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.
SQLServerStatementParser.parseInsert0 (cognitive 22) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:281— SQLServerStatementParser.parseInsert0 has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, loops 1 (2 pts) (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.
SQLExprParser.parseDataTypeRest (cognitive 22) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4660— SQLExprParser.parseDataTypeRest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 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.
SQLSelectParser.parseSortBy (cognitive 22) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:806— SQLSelectParser.parseSortBy has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 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.
SchemaResolveVisitorFactory.resolveUnion (cognitive 22) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2403— SchemaResolveVisitorFactory.resolveUnion has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (7 pts), boolean chains 3 (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.
SchemaStatVisitor.visit (cognitive 22) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:650— SchemaStatVisitor.visit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 2 (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.
FileNodeListener.refresh (cognitive 21) core/src/main/java/com/alibaba/druid/pool/ha/node/FileNodeListener.java:83— FileNodeListener.refresh has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, 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.
SQLAggregateExpr.equals (cognitive 21) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:243— SQLAggregateExpr.equals has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 9, boolean chains 2 (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.
SQLCaseStatement.accept0 (cognitive 21) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLCaseStatement.java:59— SQLCaseStatement.accept0 has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (6 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.
SQLJoinTableSource.equals (cognitive 21) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLJoinTableSource.java:651— SQLJoinTableSource.equals has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, ternaries 5 (9 pts), boolean chains 1 (nesting depth added 4). 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.
SQLSelectQueryBlock.findSelectItemAndComputeDataType (cognitive 21) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1269— SQLSelectQueryBlock.findSelectItemAndComputeDataType has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (3 pts), boolean chains 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.
SQLUnique.applyColumnRename (cognitive 21) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:159— SQLUnique.applyColumnRename has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (16 pts), boolean chains 4, loops 1 (nesting depth added 11). 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.
GaussDbCreateTableParser.parsePartitionBy (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:129— GaussDbCreateTableParser.parsePartitionBy has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (4 pts) (nesting depth added 13). 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.
ImpalaCreateTableParser.parsePartitionBy (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:177— ImpalaCreateTableParser.parsePartitionBy has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (4 pts) (nesting depth added 13). 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.
MySqlTableIndex.applyColumnRename (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlTableIndex.java:104— MySqlTableIndex.applyColumnRename has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (16 pts), boolean chains 4, loops 1 (nesting depth added 11). 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.
MySqlStatementParser.parseAlterTableAddColumn (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7581— MySqlStatementParser.parseAlterTableAddColumn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 2, 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.
MySqlOutputVisitor.printInsertColumns (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5321— MySqlOutputVisitor.printInsertColumns has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 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.
OdpsOutputVisitor.visit (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1253— OdpsOutputVisitor.visit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5 (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.
OracleIntervalExpr.equals (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleIntervalExpr.java:170— OracleIntervalExpr.equals has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (21 pts) (nesting depth added 4). 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.
OracleExprParser.parseUsingIndex (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1217— OracleExprParser.parseUsingIndex has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 2 (4 pts), boolean chains 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.
OracleStatementParser.parseCreateProcedure (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2796— OracleStatementParser.parseCreateProcedure has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (21 pts) (nesting depth added 4). 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.
OracleOutputVisitor.visit (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2236— OracleOutputVisitor.visit has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 8 (10 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.
PGOutputVisitor.visit (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:787— PGOutputVisitor.visit has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 9 (10 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.
StarRocksCreateTableParser.parsePartitionBy (cognitive 21) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java:178— StarRocksCreateTableParser.parsePartitionBy has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 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.
SQLCreateTableParser.createTableBodyItem (cognitive 21) core/src/main/java/com/alibaba/druid/sql/parser/SQLCreateTableParser.java:117— SQLCreateTableParser.createTableBodyItem has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (18 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.
SchemaStatVisitor.setColumn (cognitive 21) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1699— SchemaStatVisitor.setColumn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 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.
DruidStatInterceptor.getMethodInfo (cognitive 21) core/src/main/java/com/alibaba/druid/support/spring/stat/DruidStatInterceptor.java:87— DruidStatInterceptor.getMethodInfo has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2, boolean chains 1, error handling 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.
LogFilter.logParameter (cognitive 20) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:838— LogFilter.logParameter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 pts), match/switch 1 (3 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.
StatFilter.internalAfterStatementExecute (cognitive 20) core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:470— StatFilter.internalAfterStatementExecute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 1 (4 pts), error handling 1 (3 pts), loops 1 (3 pts), boolean chains 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.
DruidDataSource.pollLast (cognitive 20) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:2225— DruidDataSource.pollLast has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1, error handling 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.
DruidDataSource.setConnectProperties (cognitive 20) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:609— DruidDataSource.setConnectProperties has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (4 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.
SQLBinaryOpExpr.replace (cognitive 20) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:502— SQLBinaryOpExpr.replace has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (20 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.
SQLCreateTableStatement.cloneTo (cognitive 20) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1285— SQLCreateTableStatement.cloneTo has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, loops 5. 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.
SQLJoinTableSource.rearrangement (cognitive 20) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLJoinTableSource.java:347— SQLJoinTableSource.rearrangement has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 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.
SQLSelect.accept0 (cognitive 20) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelect.java:128— SQLSelect.accept0 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 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.
SQLUpdateStatement.equals (cognitive 20) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:373— SQLUpdateStatement.equals has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 8, boolean chains 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.
SQLIndexDefinition.getOption (cognitive 20) core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexDefinition.java:433— SQLIndexDefinition.getOption has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (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.
SQLOver.accept0 (cognitive 20) core/src/main/java/com/alibaba/druid/sql/ast/SQLOver.java:54— SQLOver.accept0 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (3 pts) (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.
SQLOver.equals (cognitive 20) core/src/main/java/com/alibaba/druid/sql/ast/SQLOver.java:211— SQLOver.equals has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, ternaries 4 (8 pts), boolean chains 1 (nesting depth added 4). 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.
CKOutputVisitor.visit (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:189— CKOutputVisitor.visit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (8 pts), 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.
DmLexer.scanString (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:97— DmLexer.scanString has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 pts), 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.
H2OutputVisitor.printTableElements (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:130— H2OutputVisitor.printTableElements has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, 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.
MySqlCreateTableParser.parseTableOptionCharsetOrCollate (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1463— MySqlCreateTableParser.parseTableOptionCharsetOrCollate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (20 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.
MySqlStatementParser.alterUser (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8146— MySqlStatementParser.alterUser has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 pts), 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.
MySqlStatementParser.parseDeclareHandler (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9014— MySqlStatementParser.parseDeclareHandler has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (19 pts), loops 1 (nesting depth added 4). 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.
MySqlOutputVisitor.visit (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:798— MySqlOutputVisitor.visit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, ternaries 1 (2 pts), loops 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.
OdpsStatementParser.parseSet (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1263— OdpsStatementParser.parseSet has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3 (nesting depth added 4). 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.
OracleExprParser.parseColumnRest (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1284— OracleExprParser.parseColumnRest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 1, loops 1 (nesting depth added 4). 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.
OracleSelectParser.parseTableSourceQueryTableExpr (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:674— OracleSelectParser.parseTableSourceQueryTableExpr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (20 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.
OracleSelectParser.parseWith (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:163— OracleSelectParser.parseWith has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (4 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.
OracleOutputVisitor.visit (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1544— OracleOutputVisitor.visit has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 6 (8 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.
OscarStatementParser.parseCreateIndex (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:590— OscarStatementParser.parseCreateIndex has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 2 (3 pts) (nesting depth added 5). 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.
PGOutputVisitor.visit (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:208— PGOutputVisitor.visit has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 8 (9 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.
SnowflakeExprParser.parseColumnRest (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:239— SnowflakeExprParser.parseColumnRest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (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.
SQLServerStatementParser.parseCreateProcedure (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:681— SQLServerStatementParser.parseCreateProcedure has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (3 pts), boolean chains 2 (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.
StarRocksCreateTableParser.parseIndex (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java:59— StarRocksCreateTableParser.parseIndex has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 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.
TDSelectParser.parseBeforeSelectList (cognitive 20) core/src/main/java/com/alibaba/druid/sql/dialect/teradata/parser/TDSelectParser.java:92— TDSelectParser.parseBeforeSelectList has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 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.
Schema.computeTables (cognitive 20) core/src/main/java/com/alibaba/druid/sql/repository/Schema.java:286— Schema.computeTables has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 1 (nesting depth added 11). 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.
SQLASTOutputVisitorBinaryOpSupport.visitBetweenExpr (cognitive 20) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitorBinaryOpSupport.java:40— SQLASTOutputVisitorBinaryOpSupport.visitBetweenExpr has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, ternaries 4 (8 pts) (nesting depth added 4). 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.
SchemaStatVisitor.statAllColumn (cognitive 20) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:1843— SchemaStatVisitor.statAllColumn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 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.
SchemaStatVisitor.visit (cognitive 20) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3097— SchemaStatVisitor.visit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (7 pts), boolean chains 3 (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.
DruidStatManagerFacade.getSqlStatDataList (cognitive 20) core/src/main/java/com/alibaba/druid/stat/DruidStatManagerFacade.java:135— DruidStatManagerFacade.getSqlStatDataList has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). 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.
DruidDataSourceUtils.configFromProperties (cognitive 20) core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:238— DruidDataSourceUtils.configFromProperties has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, error handling 3 (6 pts) (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.
WallVisitorUtils.checkUpdateForMultiTenant (cognitive 20) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:511— WallVisitorUtils.checkUpdateForMultiTenant has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3 (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.
WallFilter.initWallProviderInternal (cognitive 20) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:124— WallFilter.initWallProviderInternal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 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.
MonitorStatService.service (cognitive 20) druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:150— MonitorStatService.service has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 4, ternaries 1 (2 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.
MySqlMockExecuteHandlerImpl.executeQueryFromDual (cognitive 19) core/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java:106— MySqlMockExecuteHandlerImpl.executeQueryFromDual has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 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.
DruidPooledConnection.closePoolableStatement (cognitive 19) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:138— DruidPooledConnection.closePoolableStatement has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (6 pts), boolean chains 2 (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.
SQLPartitionOf.accept0 (cognitive 19) core/src/main/java/com/alibaba/druid/sql/ast/SQLPartitionOf.java:130— SQLPartitionOf.accept0 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.
BigQueryExprParser.parseDataTypeStruct0 (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:141— BigQueryExprParser.parseDataTypeStruct0 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (3 pts), boolean chains 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.
DmExprParser.primaryRest (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:183— DmExprParser.primaryRest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3 (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.
HiveCreateTableParser.createTableBody (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:50— HiveCreateTableParser.createTableBody has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 1 (2 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.
HiveExprParser.parseAliasExpr (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:301— HiveExprParser.parseAliasExpr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (17 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.
MySqlCreateTableStatement.accept0 (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:110— MySqlCreateTableStatement.accept0 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 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.
MySqlStatementParser.alterEvent (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5665— MySqlStatementParser.alterEvent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 1 (nesting depth added 4). 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.
MySqlStatementParser.parseBackup (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:1797— MySqlStatementParser.parseBackup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (5 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.
MySqlStatementParser.parseCopy (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9166— MySqlStatementParser.parseCopy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 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.
MySqlStatementParser.parseCreateProcedure (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8301— MySqlStatementParser.parseCreateProcedure has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 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.
PGSQLStatementParser.parseCreateSchema (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:281— PGSQLStatementParser.parseCreateSchema has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 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.
PGOutputVisitor.visit (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:969— PGOutputVisitor.visit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 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.
PrestoSelectParser.parseFetchClause (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoSelectParser.java:149— PrestoSelectParser.parseFetchClause has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4 (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.
PrestoSelectParser.query (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoSelectParser.java:56— PrestoSelectParser.query has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 2 (nesting depth added 2). 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.
SnowflakeStatementParser.parseStageOptions (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeStatementParser.java:599— SnowflakeStatementParser.parseStageOptions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), 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.
SuperSqlCreateTableParser.parseCreateTableRest (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/supersql/parser/SuperSqlCreateTableParser.java:16— SuperSqlCreateTableParser.parseCreateTableRest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2, loops 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.
SynapseCreateTableParser.parseSynapseWithOptions (cognitive 19) core/src/main/java/com/alibaba/druid/sql/dialect/synapse/parser/SynapseCreateTableParser.java:45— SynapseCreateTableParser.parseSynapseWithOptions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 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.
Lexer.decimalValue (cognitive 19) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:3239— Lexer.decimalValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (3 pts), ternaries 1 (3 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.
Lexer.integerValue (cognitive 19) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:3166— Lexer.integerValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 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.
SQLASTOutputVisitor.printHierarchical (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9059— SQLASTOutputVisitor.printHierarchical has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 4 (7 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.
SQLEvalVisitorUtils.type (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:624— SQLEvalVisitorUtils.type has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (4 pts), boolean chains 2 (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.
SchemaStatVisitor.handleName (cognitive 19) core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:189— SchemaStatVisitor.handleName has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 1 (2 pts), 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.
JSONParser.scanString (cognitive 19) core/src/main/java/com/alibaba/druid/support/json/JSONParser.java:277— JSONParser.scanString has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1, loops 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.
SqlTypeUDF.getSqlTypeForSingleLineSql (cognitive 19) core/src/main/java/com/alibaba/druid/support/opds/udf/SqlTypeUDF.java:284— SqlTypeUDF.getSqlTypeForSingleLineSql has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 1 (3 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
DruidAbstractDataSource.initSqls (cognitive 18) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java:1948— DruidAbstractDataSource.initSqls has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (7 pts), 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.
SQLDateTimeExpr.check (cognitive 18) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateTimeExpr.java:93— SQLDateTimeExpr.check has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SQLTimeExpr.check (cognitive 18) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimeExpr.java:105— SQLTimeExpr.check has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
HiveExprParser.primary (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:248— HiveExprParser.primary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 8). 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.
MySqlStatementParser.parseRollback (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4057— MySqlStatementParser.parseRollback has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1 (2 pts) (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.
OdpsOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:992— OdpsOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 5 (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.
OracleSelectTableReference.equals (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectTableReference.java:90— OracleSelectTableReference.equals has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 8, boolean chains 1 (nesting depth added 4). 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.
OracleSelectParser.parseModelRulesClause (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:481— OracleSelectParser.parseModelRulesClause has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), 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.
OracleStatementParser.parseCreateSequence (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2725— OracleStatementParser.parseCreateSequence has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1, loops 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.
OracleOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:561— OracleOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (7 pts), loops 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.
PGSQLStatementParser.parseVacuumTable (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1267— PGSQLStatementParser.parseVacuumTable has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 2 (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.
SQLServerOutputVisitor.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:314— SQLServerOutputVisitor.visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 1 (3 pts), ternaries 2 (3 pts) (nesting depth added 11). 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.
StarRocksOutputVisitor.print (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:202— StarRocksOutputVisitor.print has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, 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.
StarRocksOutputVisitor.printUniqueKey (cognitive 18) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:120— StarRocksOutputVisitor.printUniqueKey has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 5 (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.
SQLExprParser.exprList (cognitive 18) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2256— SQLExprParser.exprList has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 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.
SQLExprParser.primarySub (cognitive 18) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1170— SQLExprParser.primarySub has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 7). 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.
SQLSelectParser.parseUnnestTableSource (cognitive 18) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1443— SQLSelectParser.parseUnnestTableSource has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 1 (nesting depth added 10). 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.
SQLStatementParser.alterResourceGroup (cognitive 18) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7539— SQLStatementParser.alterResourceGroup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (5 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. This shape REPEATS in the file: one other method here (SQLStatementParser.createResource) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SQLStatementParser.createResource (cognitive 18) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7493— SQLStatementParser.createResource has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (5 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. This shape REPEATS in the file: one other method here (SQLStatementParser.alterResourceGroup) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SQLStatementParser.parseAlterTableAddColumn (cognitive 18) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5219— SQLStatementParser.parseAlterTableAddColumn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, 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.
Greatest.eval (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Greatest.java:49— Greatest.eval has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 10). 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.
Least.eval (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Least.java:49— Least.eval has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 10). 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.
SQLASTOutputVisitor.isTableSourceAlias (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:2345— SQLASTOutputVisitor.isTableSourceAlias has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 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.
SQLEvalVisitorUtils.visit (cognitive 18) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:790— SQLEvalVisitorUtils.visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, 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.
WallVisitorUtils.checkJoinConditionForMultiTenant (cognitive 18) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:749— WallVisitorUtils.checkJoinConditionForMultiTenant 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.
WallVisitorUtils.getValue_and (cognitive 18) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1107— WallVisitorUtils.getValue_and has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, 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.
LogFilter.statement_executeErrorAfter (cognitive 17) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:790— LogFilter.statement_executeErrorAfter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 1 (5 pts), loops 1 (4 pts) (nesting depth added 10). 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.
DruidDataSource.fill (cognitive 17) core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:3812— DruidDataSource.fill has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 3 (6 pts), 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.
DruidDriver.parseConfig (cognitive 17) core/src/main/java/com/alibaba/druid/proxy/DruidDriver.java:203— DruidDriver.parseConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts), boolean chains 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.
SQLExprTableSource.equals (cognitive 17) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprTableSource.java:525— SQLExprTableSource.equals has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 7, boolean chains 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.
SQLIndexDefinition.cloneTo (cognitive 17) core/src/main/java/com/alibaba/druid/sql/ast/SQLIndexDefinition.java:332— SQLIndexDefinition.cloneTo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 3. 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.
CKStatementParser.parseCreateMaterializedView (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKStatementParser.java:175— CKStatementParser.parseCreateMaterializedView has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). 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.
CKOutputVisitor.printComment (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:239— CKOutputVisitor.printComment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, loops 1 (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.
DorisSelectParser.parseAfterTableSourceRest (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/doris/parser/DorisSelectParser.java:46— DorisSelectParser.parseAfterTableSourceRest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 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.
GaussDbCreateTableParser.parseDistributeBy (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:229— GaussDbCreateTableParser.parseDistributeBy has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (4 pts) (nesting depth added 10). 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.
HologresOutputVisitor.printComment (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java:61— HologresOutputVisitor.printComment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, loops 1 (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.
MySqlCreateTableStatement.cloneTo (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:465— MySqlCreateTableStatement.cloneTo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, loops 3 (4 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.
MySqlLexer.scanSharp (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:127— MySqlLexer.scanSharp has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 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.
MySqlSelectParser.parseUpdateStatment (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:486— MySqlSelectParser.parseUpdateStatment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 2 (nesting depth added 2). 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.
OdpsStatementParser.parseLoad (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1525— OdpsStatementParser.parseLoad has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 1 (2 pts) (nesting depth added 4). 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.
OdpsStatementParser.parseUnload (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:675— OdpsStatementParser.parseUnload has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 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.
OracleSelectParser.parseTableSourcePrimary (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:616— OracleSelectParser.parseTableSourcePrimary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 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.
OracleOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2519— OracleOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5, boolean chains 1, loops 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.
OscarCreateTableParser.parsePartitionBy (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:21— OscarCreateTableParser.parsePartitionBy has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 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.
SnowflakeExprParser.parseLimit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:304— SnowflakeExprParser.parseLimit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (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.
SQLServerOutputVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:89— SQLServerOutputVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (6 pts), loops 1 (2 pts) (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.
StarRocksCreateTableParser.parseCreateTableRest (cognitive 17) core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/parser/StarRocksCreateTableParser.java:101— StarRocksCreateTableParser.parseCreateTableRest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (17 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.
SQLExprParser.parseAggregateExpr (cognitive 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2546— SQLExprParser.parseAggregateExpr has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16 (17 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.
SQLExprParser.parseSelectItemRest (cognitive 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5790— SQLExprParser.parseSelectItemRest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2 (nesting depth added 8). 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.
SQLParser.alias (cognitive 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLParser.java:671— SQLParser.alias has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 1 (2 pts), boolean chains 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.
SQLSelectParser.parseFetchClause (cognitive 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2198— SQLSelectParser.parseFetchClause has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4 (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.
SQLSelectParser.parseLateralTableSource (cognitive 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1401— SQLSelectParser.parseLateralTableSource 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.
SQLStatementParser.parseStart (cognitive 17) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7919— SQLStatementParser.parseStart has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (17 pts) (nesting depth added 4). 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.
SchemaResolveVisitorFactory.unwrapAlias (cognitive 17) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1359— SchemaResolveVisitorFactory.unwrapAlias has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 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.
Substring.eval (cognitive 17) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Substring.java:30— Substring.eval has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5 (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.
SQLASTOutputVisitor.replaceQuota (cognitive 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3148— SQLASTOutputVisitor.replaceQuota has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 6 (nesting depth added 6). 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.
SQLEvalVisitorUtils.visit (cognitive 17) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:860— SQLEvalVisitorUtils.visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (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.
PagerUtils.count (cognitive 17) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:481— PagerUtils.count has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1 (3 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.
JdbcConnectionStat.afterClose (cognitive 17) core/src/main/java/com/alibaba/druid/stat/JdbcConnectionStat.java:201— JdbcConnectionStat.afterClose has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2, boolean chains 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.
WebAppStat.computeUserAgentAndroid (cognitive 17) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:850— WebAppStat.computeUserAgentAndroid has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16 (17 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.
FnvHash.hashCode64 (cognitive 17) core/src/main/java/com/alibaba/druid/util/FnvHash.java:201— FnvHash.hashCode64 has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 1 (2 pts) (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.
ServletPathMatcher.matches (cognitive 17) core/src/main/java/com/alibaba/druid/util/ServletPathMatcher.java:36— ServletPathMatcher.matches 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.
MySqlWallVisitor.visit (cognitive 17) core/src/main/java/com/alibaba/druid/wall/spi/MySqlWallVisitor.java:142— MySqlWallVisitor.visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5 (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.
WallVisitorUtils.checkSelect (cognitive 17) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:198— WallVisitorUtils.checkSelect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, 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.
WallVisitorUtils.getConditionValue (cognitive 17) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1422— WallVisitorUtils.getConditionValue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6 (nesting depth added 3). 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.
WallVisitorUtils.isSimpleCaseTableSource (cognitive 17) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1654— WallVisitorUtils.isSimpleCaseTableSource has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (17 pts) (nesting depth added 10). 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.
WallVisitorUtils.isTopFromDenySchema (cognitive 17) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:1821— WallVisitorUtils.isTopFromDenySchema has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 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.
StatFilter.resultSet_close (cognitive 16) core/src/main/java/com/alibaba/druid/filter/stat/StatFilter.java:627— StatFilter.resultSet_close has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 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.
PoolUpdater.removeDataSources (cognitive 16) core/src/main/java/com/alibaba/druid/pool/ha/node/PoolUpdater.java:146— PoolUpdater.removeDataSources has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (5 pts), boolean chains 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.
RandomDataSourceValidateThread.maintainBlacklist (cognitive 16) core/src/main/java/com/alibaba/druid/pool/ha/selector/RandomDataSourceValidateThread.java:140— RandomDataSourceValidateThread.maintainBlacklist has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), boolean chains 3 (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.
DruidPooledPreparedStatement.close (cognitive 16) core/src/main/java/com/alibaba/druid/pool/DruidPooledPreparedStatement.java:153— DruidPooledPreparedStatement.close has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 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.
SQLAggregateExpr.accept0 (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:180— SQLAggregateExpr.accept0 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (2 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.
SQLBetweenExpr.equals (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBetweenExpr.java:135— SQLBetweenExpr.equals has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (16 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.
SQLBinaryOpExpr.and (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:377— SQLBinaryOpExpr.and has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (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.
SQLBinaryOpExpr.andIfNotExists (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExpr.java:461— SQLBinaryOpExpr.andIfNotExists has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), 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.
SQLBinaryOpExprGroup.replace (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBinaryOpExprGroup.java:139— SQLBinaryOpExprGroup.replace has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 2 (5 pts), boolean chains 2 (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.
SQLIdentifierExpr.computeDataType (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLIdentifierExpr.java:241— SQLIdentifierExpr.computeDataType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 1 (3 pts), loops 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.
SQLCreateTableStatement.isMUL (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:577— SQLCreateTableStatement.isMUL has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 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.
SQLSelectQueryBlock.findSelectItem (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1315— SQLSelectQueryBlock.findSelectItem has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 2 (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.
SQLSelectQueryBlock.replace (cognitive 16) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1180— SQLSelectQueryBlock.replace has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 6. 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.
DB2CreateTableParser.parseCreateTableRest (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2CreateTableParser.java:38— DB2CreateTableParser.parseCreateTableRest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 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.
DB2StatementParser.parseAlterColumn (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:144— DB2StatementParser.parseAlterColumn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 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.
DB2StatementParser.parseTruncate (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:227— DB2StatementParser.parseTruncate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), 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.
HiveOutputVisitor.printTableElementsWithComment (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:707— HiveOutputVisitor.printTableElementsWithComment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, loops 1 (2 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.
MySqlSubPartitionByValue.isPartitionByColumn (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSubPartitionByValue.java:77— MySqlSubPartitionByValue.isPartitionByColumn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 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.
MySqlUpdateStatement.equals (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlUpdateStatement.java:152— MySqlUpdateStatement.equals has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, ternaries 3 (5 pts), boolean chains 1 (nesting depth added 2). 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.
MySqlExprParser.methodRestAllowIdentifierMethodSpecific (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:319— MySqlExprParser.methodRestAllowIdentifierMethodSpecific has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 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.
MySqlExprParser.userNameRest (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1521— MySqlExprParser.userNameRest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 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.
MySqlStatementParser.parseCreateFunction (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8221— MySqlStatementParser.parseCreateFunction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 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.
OracleOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:74— OracleOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (7 pts) (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.
OscarPermissionOutputVisitor.visit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarPermissionOutputVisitor.java:41— OscarPermissionOutputVisitor.visit has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 5 (6 pts), boolean chains 2, loops 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.
PGSQLStatementParser.parseDeleteStatement (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:441— PGSQLStatementParser.parseDeleteStatement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (16 pts) (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.
SnowflakeExprParser.parseJSONObject (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeExprParser.java:181— SnowflakeExprParser.parseJSONObject has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 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.
SnowflakeSelectParser.parseTableSourceSample (cognitive 16) core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeSelectParser.java:262— SnowflakeSelectParser.parseTableSourceSample has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (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.
SQLExprParser.multiplicativeRest (cognitive 16) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:292— SQLExprParser.multiplicativeRest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3 (nesting depth added 2). 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.
SQLStatementParser.alterTableChange (cognitive 16) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2783— SQLStatementParser.alterTableChange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 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.
SQLASTOutputVisitor.printComment (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7229— SQLASTOutputVisitor.printComment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, loops 1 (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.
SQLASTOutputVisitor.printExpr (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1098— SQLASTOutputVisitor.printExpr has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. 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.
SQLASTOutputVisitor.unwrapShardingTable (cognitive 16) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:1440— SQLASTOutputVisitor.unwrapShardingTable has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), loops 1, ternaries 1 (nesting depth added 2). 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.
PagerUtils.limitDB2 (cognitive 16) core/src/main/java/com/alibaba/druid/sql/PagerUtils.java:213— PagerUtils.limitDB2 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2 (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.
SQLUtils.getLimit (cognitive 16) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:2231— SQLUtils.getLimit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (6 pts) (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.
IPAddress.parseIPAddress (cognitive 16) core/src/main/java/com/alibaba/druid/support/http/util/IPAddress.java:124— IPAddress.parseIPAddress has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, error handling 2, loops 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.
JSONParser.nextToken (cognitive 16) core/src/main/java/com/alibaba/druid/support/json/JSONParser.java:157— JSONParser.nextToken has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 1, loops 1, match/switch 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.
MySqlUtils.decimal (cognitive 16) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:786— MySqlUtils.decimal has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 5 (7 pts), 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.
WallProvider.checkWhiteAndBlackList (cognitive 16) core/src/main/java/com/alibaba/druid/wall/WallProvider.java:625— WallProvider.checkWhiteAndBlackList 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.
D4 · Code Duplication· Near-duplicate member family (6 members, 39 shared lines) · ×1
Near-duplicate member family (6 members, 39 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:174— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:174-315 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:341-476 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:120-276 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:488-642 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1799-1900 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1902-2024 — These 6 members are variants of one another: a block of 39 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 (4 members, 46 shared lines) · ×1
Near-duplicate member family (4 members, 46 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:120— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:120-276 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:488-642 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:99-188 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:103-192 — These 4 members are variants of one another: a block of 46 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, 28 shared lines) · ×1
Near-duplicate member family (4 members, 28 shared lines) REDACTED:68— REDACTED:68-123 | core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:42-108 | REDACTED:55-110 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:41-107 — These 4 members are variants of one another: a block of 28 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, 22 shared lines) · ×1
Near-duplicate member family (4 members, 22 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:144— core/src/main/java/com/alibaba/druid/sql/dialect/db2/parser/DB2StatementParser.java:144-187 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:220-255 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:453-488 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:951-1008 — These 4 members are variants of one another: a block of 22 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, 20 shared lines) · ×1
Near-duplicate member family (4 members, 20 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:28— core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:28-117 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:127-355 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:32-175 | core/src/main/java/com/alibaba/druid/sql/dialect/supersql/parser/SuperSqlCreateTableParser.java:16-44 — These 4 members are variants of one another: a block of 20 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 (3 members, 76 shared lines) · ×1
Near-duplicate member family (3 members, 76 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:29— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:29-228 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:49-249 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:49-254 — These 3 members are variants of one another: a block of 76 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 3 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 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 54 shared lines) · ×1
Near-duplicate member family (3 members, 54 shared lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6062— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6062-6386 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6388-6660 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6667-6924 — These 3 members are variants of one another: a block of 54 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 3 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 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 26 shared lines) · ×1
Near-duplicate member family (3 members, 26 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:74— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:74-112 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2134-2165 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2627-2658 — These 3 members are variants of one another: a block of 26 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 3 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 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 19 shared lines) · ×1
Near-duplicate member family (3 members, 19 shared lines) core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:425— core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:425-509 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:511-564 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:566-643 — These 3 members are variants of one another: a block of 19 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 3 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 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 16 shared lines) · ×1
Near-duplicate member family (3 members, 16 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:278— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:278-421 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleLexer.java:253-350 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerLexer.java:77-175 — These 3 members are variants of one another: a block of 16 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 3 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 3 times.
Near-duplicate member pair (86 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:966— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:966-1126 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2431-2553 — These two members are variants of one another: 86 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.
Near-duplicate member pair (70 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:119— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:119-202 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:564-840 — These two members are variants of one another: 70 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.
Near-duplicate member pair (67 shared lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4345— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4345-4482 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7587-7699 — These two members are variants of one another: 67 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.
Near-duplicate member pair (65 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1186— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1186-1272 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1566-1649 — These two members are variants of one another: 65 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.
Near-duplicate member pair (64 shared lines) core/src/main/java/com/alibaba/druid/util/StringUtils.java:143— core/src/main/java/com/alibaba/druid/util/StringUtils.java:143-240 | core/src/main/java/com/alibaba/druid/util/StringUtils.java:242-342 — These two members are variants of one another: 64 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.
Near-duplicate member pair (54 shared lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:738— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:738-810 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSelectQueryBlock.java:249-326 — These two members are variants of one another: 54 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.
Near-duplicate member pair (53 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2005— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2005-2268 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:818-882 — These two members are variants of one another: 53 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.
Near-duplicate member pair (52 shared lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:693— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:693-800 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:802-982 — These two members are variants of one another: 52 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.
Near-duplicate member pair (48 shared lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6934— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:6934-7047 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7049-7125 — These two members are variants of one another: 48 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.
Near-duplicate member pair (43 shared lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4728— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4728-4841 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7356-7461 — These two members are variants of one another: 43 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.
Near-duplicate member pair (37 shared lines) core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:164— core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:164-220 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:6448-6537 — 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.
Near-duplicate member pair (17 shared lines) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:444— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:444-515 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11950-12010 — These two members are variants of one another: 17 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 (87 corresponding lines) · ×1
Edited copy of a member (87 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2270— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2270-2370 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7870-7968 — These two members are one piece of code written twice and then edited apart: 87 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 (86 corresponding lines) · ×1
Edited copy of a member (86 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1668— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1668-1753 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2058-2143 — These two members are one piece of code written twice and then edited apart: 86 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 (13 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (13 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1643— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1643-1671 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2764-2792 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2795-2814 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2900-2934 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2937-2964 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3208-3227 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3230-3249 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3252-3271 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3274-3293 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3296-3315 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3347-3366 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3369-3388 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3391-3418 — These 13 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 13 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 13 times.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ascii.java:28— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ascii.java:28-51 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Bin.java:27-46 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/BitLength.java:27-44 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:30-48 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Length.java:30-47 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ltrim.java:27-55 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/OneParamFunctions.java:33-85 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Reverse.java:27-48 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Trim.java:27-43 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ucase.java:30-47 — These 10 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 10 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 10 times.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (7 members, 50+ identical tokens) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:905— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:905-948 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:953-996 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1001-1351 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1356-1426 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1431-1496 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1501-1598 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1603-1734 — These 7 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 7 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 7 times.
D4 · Code Duplication· Edited copy of a member (186 corresponding lines) · ×1
Edited copy of a member (186 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:121— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:121-360 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:290-475 — These two members are one piece of code written twice and then edited apart: 186 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 (131 corresponding lines) · ×1
Edited copy of a member (131 corresponding lines) core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:395— core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:395-560 | core/src/main/java/com/alibaba/druid/util/JdbcUtils.java:562-692 — These two members are one piece of code written twice and then edited apart: 131 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 (130 corresponding lines) · ×1
Edited copy of a member (130 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2585— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2585-2715 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2721-2850 — These two members are one piece of code written twice and then edited apart: 130 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 (100 corresponding lines) · ×1
Edited copy of a member (100 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8737— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8737-8845 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8848-8947 — These two members are one piece of code written twice and then edited apart: 100 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 (75 corresponding lines) · ×1
Edited copy of a member (75 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:514— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:514-588 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1034-1118 — These two members are one piece of code written twice and then edited apart: 75 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 (93 corresponding lines) · ×1
Edited copy of a member (93 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:590— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:590-682 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1120-1220 — These two members are one piece of code written twice and then edited apart: 93 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 (82 corresponding lines) · ×1
Edited copy of a member (82 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5570— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5570-5663 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5665-5746 — These two members are one piece of code written twice and then edited apart: 82 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 (77 corresponding lines) · ×1
Edited copy of a member (77 corresponding lines) core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:78— core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:78-175 | druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:150-226 — These two members are one piece of code written twice and then edited apart: 77 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 (99 corresponding lines) · ×1
Edited copy of a member (99 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1382— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1382-1480 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1482-1584 — These two members are one piece of code written twice and then edited apart: 99 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, 77+ corresponding lines) · ×1
Edited copies of one member (3 members, 77+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:683— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:683-785 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:327-417 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1522-1598 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 77 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 (94 corresponding lines) · ×1
Edited copy of a member (94 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:72— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:72-165 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:90-198 — These two members are one piece of code written twice and then edited apart: 94 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 (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2938— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2938-2996 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8080-8135 — These two members are one piece of code written twice and then edited apart: 56 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 (70 corresponding lines) · ×1
Edited copy of a member (70 corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5516— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5516-5585 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5588-5665 — These two members are one piece of code written twice and then edited apart: 70 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, 60+ corresponding lines) · ×1
Edited copies of one member (3 members, 60+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2441— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2441-2500 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1370-1429 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1747-1806 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 60 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 (43 corresponding lines) · ×1
Edited copy of a member (43 corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStatValue.java:345— core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStatValue.java:345-390 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringMethodStatValue.java:309-351 — 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 (58 corresponding lines) · ×1
Edited copy of a member (58 corresponding lines) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3527— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3527-3606 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:3642-3699 — These two members are one piece of code written twice and then edited apart: 58 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) core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:545— core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:545-603 | core/src/main/java/com/alibaba/druid/sql/repository/SchemaRepository.java:605-663 — 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 (54 corresponding lines) · ×1
Edited copy of a member (54 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:316— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:316-369 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:441-506 — 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 (51 corresponding lines) · ×1
Edited copy of a member (51 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:21— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:21-71 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:64-124 — 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 (61 corresponding lines) · ×1
Edited copy of a member (61 corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:144— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:144-213 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:215-275 — 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 copies of one member (3 members, 58+ corresponding lines) · ×1
Edited copies of one member (3 members, 58+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1690— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1690-1747 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1757-1816 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1826-1896 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 58 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, 54+ corresponding lines) · ×1
Edited copies of one member (3 members, 54+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1898— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1898-1967 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1969-2039 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:2041-2094 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 54 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, 50+ corresponding lines) · ×1
Edited copies of one member (3 members, 50+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:253— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:253-302 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1496-1546 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:321-370 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 50 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 (50 corresponding lines) · ×1
Edited copy of a member (50 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:246— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:246-305 | core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftSelectParser.java:27-76 — These two members are one piece of code written twice and then edited apart: 50 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, 37+ corresponding lines) · ×1
Edited copies of one member (3 members, 37+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:36— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:36-72 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:59-95 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:61-97 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 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, 26+ corresponding lines) · ×1
Edited copies of one member (3 members, 26+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:41— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:41-69 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:63-88 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:74-103 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 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 (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5321— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5321-5355 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3820-3865 — 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 copies of one member (3 members, 24+ corresponding lines) · ×1
Edited copies of one member (3 members, 24+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1343— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1343-1368 | core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftExprParser.java:110-133 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5090-5113 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 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) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:856— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:856-882 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:952-978 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1332-1358 — 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 (4 members, 31+ corresponding lines) · ×1
Edited copies of one member (4 members, 31+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1601— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1601-1633 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2823-2853 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7178-7210 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10246-10281 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 31 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 (34 corresponding lines) · ×1
Edited copy of a member (34 corresponding lines) core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:876— core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:876-909 | core/src/main/java/com/alibaba/druid/support/monitor/dao/MonitorDaoJdbcImpl.java:1002-1045 — 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 copies of one member (3 members, 30+ corresponding lines) · ×1
Edited copies of one member (3 members, 30+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:285— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:285-314 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:369-401 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:3494-3527 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 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, 29+ corresponding lines) · ×1
Edited copies of one member (8 members, 29+ corresponding lines) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:355— core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:355-383 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:392-422 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:426-457 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:460-488 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:491-519 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:522-550 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:587-618 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:621-650 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 29 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 (5 members, 27+ corresponding lines) · ×1
Edited copies of one member (5 members, 27+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLArrayExpr.java:122— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLArrayExpr.java:122-148 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:123-152 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java:167-196 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInSubQueryExpr.java:126-158 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectOrderByItem.java:110-139 — These 5 members are one piece of code written 5 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 5 times and the copies 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) core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:158— core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:158-181 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:183-208 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:259-281 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:214-240 — 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 copies of one member (4 members, 10+ corresponding lines) · ×1
Edited copies of one member (4 members, 10+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:278— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAggregateExpr.java:278-287 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:323-332 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:405-414 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleUpdateStatement.java:164-174 — 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 (3 members, 25+ corresponding lines) · ×1
Edited copies of one member (3 members, 25+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLoopStatement.java:64— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLoopStatement.java:64-90 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleExitStatement.java:58-82 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OraclePipeRowStatement.java:41-66 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 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 (4 members, 16+ corresponding lines) · ×1
Edited copies of one member (4 members, 16+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsSelectQueryBlock.java:57— core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsSelectQueryBlock.java:57-75 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSelectQueryBlock.java:88-105 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarSelectQueryBlock.java:42-58 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGSelectQueryBlock.java:62-77 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 12+ corresponding lines) · ×1
Edited copies of one member (6 members, 12+ corresponding lines) core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:433— core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:433-444 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:448-460 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:464-477 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:557-568 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:572-584 | core/src/main/java/com/alibaba/druid/filter/encoding/EncodingConvertFilter.java:588-600 — These 6 members are one piece of code written 6 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 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 20+ corresponding lines) · ×1
Edited copies of one member (5 members, 20+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:79— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAllExpr.java:79-98 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLAnyExpr.java:82-101 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLExistsExpr.java:87-109 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLQueryExpr.java:76-95 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSomeExpr.java:78-97 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 13+ corresponding lines) · ×1
Edited copies of one member (4 members, 13+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1079— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1079-1091 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1093-1105 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1107-1119 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateTableStatement.java:1120-1132 — 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 (7 members, 14+ corresponding lines) · ×1
Edited copies of one member (7 members, 14+ corresponding lines) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:29— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:29-42 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:77-90 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStatUtils.java:93-106 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStatUtils.java:45-58 | core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:131-144 | core/src/main/java/com/alibaba/druid/util/DruidDataSourceUtils.java:147-160 | core/src/main/java/com/alibaba/druid/util/JdbcSqlStatUtils.java:34-47 — These 7 members are one piece of code written 7 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 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 15+ corresponding lines) · ×1
Edited copies of one member (5 members, 15+ corresponding lines) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:291— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:291-306 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:496-510 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:518-539 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:584-599 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:607-626 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×1
Edited copies of one member (3 members, 6+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:382— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:382-387 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryExprParser.java:389-397 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:398-403 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (7 members, 15+ corresponding lines) · ×1
Edited copies of one member (7 members, 15+ corresponding lines) core/src/main/java/com/alibaba/druid/util/FnvHash.java:137— core/src/main/java/com/alibaba/druid/util/FnvHash.java:137-151 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:153-167 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:169-183 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:185-199 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:236-250 | core/src/main/java/com/alibaba/druid/util/FnvHash.java:252-269 | core/src/main/java/com/alibaba/druid/util/StringUtils.java:126-141 — These 7 members are one piece of code written 7 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 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×1
Edited copies of one member (4 members, 11+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLListExpr.java:61— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLListExpr.java:61-71 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCharacterDataType.java:101-112 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropViewStatement.java:80-90 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLWithSubqueryClause.java:77-87 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 17+ corresponding lines) · ×1
Edited copies of one member (4 members, 17+ corresponding lines) core/src/main/java/com/alibaba/druid/util/HiveUtils.java:9— core/src/main/java/com/alibaba/druid/util/HiveUtils.java:9-25 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:233-249 | core/src/main/java/com/alibaba/druid/util/OracleUtils.java:172-188 | core/src/main/java/com/alibaba/druid/util/OracleUtils.java:192-208 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 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 (6 members, 7+ corresponding lines) · ×1
Edited copies of one member (6 members, 7+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLArrayExpr.java:113— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLArrayExpr.java:113-119 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLContainsExpr.java:113-120 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLInListExpr.java:157-164 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLUnaryExpr.java:83-89 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectOrderByItem.java:100-107 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/expr/MySqlOrderingExpr.java:119-125 — These 6 members are one piece of code written 6 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 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 9+ corresponding lines) · ×1
Edited copies of one member (6 members, 9+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:301— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:301-310 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:312-321 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:323-332 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:334-343 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:345-354 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:680-688 — These 6 members are one piece of code written 6 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 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×1
Edited copies of one member (3 members, 11+ corresponding lines) core/src/main/java/com/alibaba/druid/pool/vendor/MSSQLValidConnectionChecker.java:37— core/src/main/java/com/alibaba/druid/pool/vendor/MSSQLValidConnectionChecker.java:37-47 | core/src/main/java/com/alibaba/druid/pool/vendor/OracleValidConnectionChecker.java:56-68 | core/src/main/java/com/alibaba/druid/pool/vendor/PGValidConnectionChecker.java:39-49 — 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· Edited copies of one member (5 members, 7+ corresponding lines) · ×1
Edited copies of one member (5 members, 7+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlPartitionByKey.java:28— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlPartitionByKey.java:28-34 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlStatementImpl.java:32-38 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSubPartitionByKey.java:32-38 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSubPartitionByList.java:34-40 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlSubPartitionByValue.java:33-39 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (7 members, 7+ corresponding lines) · ×1
Edited copies of one member (7 members, 7+ corresponding lines) core/src/main/java/com/alibaba/druid/sql/ast/SQLArgument.java:36— core/src/main/java/com/alibaba/druid/sql/ast/SQLArgument.java:36-46 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLFlashbackExpr.java:82-89 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLNotExpr.java:104-110 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLExprHint.java:53-59 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLReturnStatement.java:57-63 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleAnalyticWindowing.java:66-73 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleOuterExpr.java:38-44 — These 7 members are one piece of code written 7 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 7 times and the copies will drift further apart.
Duplicated block (126 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:161— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:161-286 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:187-312 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 262 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 (95 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2281— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2281-2375 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2774-2868 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 (88 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2628— core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2628-2715 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2763-2850 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2628` 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 (86 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2279— core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2279-2364 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7875-7960 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2279` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7961` calls `isNotNull`, `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2366` 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 (84 lines × 2) core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:202— core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:202-285 | core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java:201-284 — `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/WebStatFilter.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 261 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/support/http/WebStatFilter.java:202` 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 (76 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1405— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1405-1480 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1509-1584 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:1405` 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 (83–85 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:276— core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:276-360 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java:393-475 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoStatementParser.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 247 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 `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:276` 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 (72 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:101— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:101-172 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:995-1066 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:153-224 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:101` 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 (46 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2455— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2455-2500 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1384-1429 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1761-1806 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2455` 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 (40–46 lines × 2) core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:67— core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:67-106 | core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java:84-129 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java` and `core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 98 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 `core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:67` 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 (44–45 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:197— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:197-240 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:364-408 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:123-167 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:491-535 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1802-1846 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 176 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:197` 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, `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1799` calls `scanString2` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:360` 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 (44 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2383— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2383-2426 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1311-1354 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1688-1731 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (43 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:727— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:727-769 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:369-411 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1555-1597 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:727` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlSelectParser.java:725` calls `setRows`, `token` and `core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1554` 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 (41 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1663— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1663-1703 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1704-1744 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2094-2134 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1663` 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 (39–41 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7499— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7499-7537 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7545-7585 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:7499` 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 (38 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:265— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:265-302 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:1509-1546 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUpdateStatement.java:333-370 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 65 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDeleteStatement.java:265` 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 (37 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2629— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2629-2665 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1551-1587 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1928-1964 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2629` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2666` calls `getParameters`, `size`, `equals` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1588` 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 (35–36 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:854— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:854-888 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:964-999 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSelectQueryBlock.java:854` 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 (34–35 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:185— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:185-218 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:257-291 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:452-486 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:185` 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 (34–35 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:1039— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:1039-1073 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:2492-2525 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleSelectParser.java:1039` 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 (32–33 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:930— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:930-962 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:7524-7555 — 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 (53 lines × 2) core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:43— core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:43-95 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:42-94 — `core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java` and `core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 103 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:43` 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 (31–32 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:254— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:254-285 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:420-450 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:254` 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 (31 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5691— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5691-5721 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2966-2996 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8105-8135 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:5691` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MysqlPartitionSingle` in one and `OraclePartitionSingle` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2964` calls `printOracleSegmentAttributes` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:8103` 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 (29 lines × 4) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1061— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1061-1089 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1135-1163 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1217-1245 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1315-1343 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1061` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLUnnestTableSource` in one and `SQLUnionQueryTableSource` 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 (22–29 lines × 2) core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:35— core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:35-63 | core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:30-51 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java` and `core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 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 `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.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.
Duplicated block (22–27 lines × 3) core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:41— core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:41-67 | core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:67-88 | core/src/main/java/com/alibaba/druid/pool/vendor/OracleExceptionSorter.java:84-107 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java` and `core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 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 `core/src/main/java/com/alibaba/druid/pool/vendor/MySqlExceptionSorter.java:41` 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 (26–27 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:170— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:170-195 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java:269-295 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:196-221 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampExpr.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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 (26 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:75— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:75-100 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2135-2160 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2628-2653 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 (25–26 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12014— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12014-12038 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12042-12067 — 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. 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 `x` to `SQLCreateResourceGroupStatement` in one and `SQLAlterResourceGroupStatement` 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 (24–25 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:733— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:733-757 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:899-922 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:733` 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 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 (24 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:245— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:245-268 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:411-434 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:170-193 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:538-561 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 176 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.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. 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–24 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:390— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:390-411 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:440-463 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlCreateTableStatement.java:390` 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 (17–23 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:86— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:86-108 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:143-159 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:136-152 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` as WHOLE FILES: this scan already matched 8 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:86` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:84` calls `parseHierachical` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:141` 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 (22–23 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:95— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:95-116 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:124-145 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:126-148 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:95` 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–23 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:192— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:192-214 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:216-237 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:192` 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 (20–22 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:161— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:161-182 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:190-209 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:183-202 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java` as WHOLE FILES: this scan already matched 8 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:161` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSelectParser.java:182` calls `nextToken` and `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:159` 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 (20–21 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:41— core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:41-61 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:169-189 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:41-61 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:263-283 | core/src/main/java/com/alibaba/druid/sql/dialect/supersql/parser/SuperSqlCreateTableParser.java:22-41 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 95 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 `core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:41` 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 (19–21 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1276— core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1276-1296 | core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1674-1692 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLSelectParser.java:1276` 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 (20 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:285— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:285-304 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:450-469 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:250-269 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:616-635 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1874-1893 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1998-2017 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 176 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:285` 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 (20–21 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1896— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1896-1915 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2389-2408 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12187-12207 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12226-12246 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java` as WHOLE FILES: this scan already matched 99 separate duplicated blocks between them, totalling at least 1839 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1896` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLUnpivot` in one and `SQLPivot` 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 (18–20 lines × 3) core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:737— core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java:737-756 | core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:267-284 | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringMethodStat.java:219-236 — 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 `core/src/main/java/com/alibaba/druid/support/http/stat/WebURIStat.java:267` 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 (19 lines × 10) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:281— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:281-299 | core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:446-464 | core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:112-130 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java:246-264 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:612-630 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:158-176 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:162-180 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1763-1781 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1870-1888 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1994-2012 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveLexer.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 176 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:281` 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, `core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1992` calls `String` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryLexer.java:280` 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 (19 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:159— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:159-177 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:224-242 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGLexer.java:228-246 | core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:2356-2375 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 89 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmLexer.java:159` 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–19 lines × 3) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:565— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:565-577 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:633-651 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:656-668 — 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. 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 × 7) core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:906— core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:906-923 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:954-971 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1002-1019 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1357-1374 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1432-1449 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1502-1519 | core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:1604-1621 — 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 `core/src/main/java/com/alibaba/druid/sql/SQLUtils.java:906` 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 × 4) core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:84— core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:84-101 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:185-202 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1174-1191 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1495-1512 — 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.
Duplicated block (15–18 lines × 3) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1640— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1640-1657 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1662-1678 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1681-1695 — 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 (16–18 lines × 2) core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:841— core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:841-858 | core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:873-888 — 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 `core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java:841` 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 (37–38 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:171— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:171-208 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:247-283 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:171` 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 (17 lines × 13) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1655— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1655-1671 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2776-2792 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2798-2814 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2918-2934 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2948-2964 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3211-3227 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3233-3249 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3255-3271 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3277-3293 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3299-3315 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3350-3366 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3372-3388 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3402-3418 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1655` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MySqlShowDatabaseStatusStatement` in one and `MySqlShowSlowStatement` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2946` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2774` 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–17 lines × 4) core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1331— core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1331-1347 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1386-1401 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2161-2172 | core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:2221-2232 — 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 `core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:1331` 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 (16–17 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:970— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:970-985 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1092-1107 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1472-1487 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:324-340 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `x` to `InsertIntoClause` in one and `OracleMultiInsertStatement.InsertIntoClause` 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 (16–17 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:78— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:78-93 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:100-116 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:102-118 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 (14–17 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:763— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:763-778 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:780-796 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9360-9373 — 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 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 (16 lines × 9) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1831— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1831-1846 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1850-1865 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1882-1897 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1777-1792 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1796-1811 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1815-1830 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2167-2182 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2186-2201 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2205-2220 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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: the declarations holding them bind `x` to `OracleAlterTriggerStatement` in one and `OracleAlterSynonymStatement` 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 (15–16 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:209— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:209-223 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:548-563 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:282-296 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:308-322 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:477-491 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:503-517 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.java:548` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:306` calls `setWithTimeZone` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleExprParser.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.
Duplicated block (14–16 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1034— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1034-1049 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1158-1171 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1538-1551 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1034` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `ConditionalInsertClause` in one and `OracleMultiInsertStatement.ConditionalInsertClause` 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 (14–16 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:161— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:161-176 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:4637-4650 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:161` 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 × 13) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3005— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3005-3019 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3422-3436 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3445-3459 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3468-3482 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3491-3505 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3514-3528 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3593-3607 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3636-3650 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3660-3674 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3705-3719 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3728-3742 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3756-3770 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:4029-4043 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3772` calls `setFull` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3438` 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 (15 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1456— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1456-1470 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2209-2223 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2702-2716 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7751-7765 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7776-7790 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7776` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `SQLIfStatement.Else` in one and `SQLIfStatement.ElseIf` 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 (15 lines × 4) core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2434— core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2434-2448 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4260-4274 | core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java:3129-3143 | core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.java:2288-2302 — 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 `core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2434` 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 (26–27 lines × 2) core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:397— core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:397-422 | core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:431-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 `core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java:397` 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 (13–15 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8643— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8643-8657 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1345-1357 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8643` 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–14 lines × 8) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:985— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:985-997 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1022-1035 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1061-1074 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1087-1100 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1113-1125 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1138-1150 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1163-1175 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1188-1200 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1022` 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 (14 lines × 6) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLateralViewTableSource.java:134— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLateralViewTableSource.java:134-147 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQueryTableSource.java:76-89 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLValuesTableSource.java:104-117 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlUpdateTableSource.java:60-73 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java:70-83 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGFunctionTableSource.java:70-83 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarFunctionTableSource.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/stmt/PGFunctionTableSource.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLLateralViewTableSource.java:134` 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 (23–26 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:275— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:275-297 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:591-616 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:1121-1146 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 (10–14 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:209— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:209-222 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:216-229 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java:493-502 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGSQLStatementParser.java` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 578 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:209` 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–14 lines × 2) core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2070— core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2070-2081 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:6082-6095 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:2070` 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–13 lines × 10) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:188— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:188-199 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:204-216 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:222-233 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:264-275 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:279-291 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:298-309 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:319-330 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:350-362 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:377-389 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9252-9264 — there are 10 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 10 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:204` 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 after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:294` calls `mark` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:219` 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 (13 lines × 8) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:281— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:281-293 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:304-316 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:327-339 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:400-412 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:423-435 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:446-458 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:469-481 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:492-504 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:281` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:340` calls `getArguments`, `get`, `accept` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:294` 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–13 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:65— core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java:65-76 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java:193-204 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:818-829 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsCreateTableParser.java:307-318 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsStatementParser.java:1653-1665 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveCreateTableParser.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 95 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 `stmt` to `SQLCreateTableStatement` in one and `SQLAlterTableStatement` 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 (13 lines × 5) core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1179— core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1179-1191 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1201-1213 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1249-1261 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1273-1285 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1288-1300 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:1179` 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 (12–13 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:314— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java:314-326 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveStatementParser.java:420-432 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java:638-650 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.java:58-69 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmStatementParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarStatementParser.java` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 279 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 (11–13 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6442— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6442-6452 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkStatementParser.java:73-85 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkStatementParser.java:102-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.
Duplicated block (10–13 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:330— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:330-339 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:562-574 — 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:558` calls `identifierEquals`, `parseTryCatch` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/parser/BigQueryStatementParser.java:329` 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–13 lines × 2) core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4951— core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4951-4963 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:5036-5046 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:4951` 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: the declarations holding them bind `x` to `SQLSubqueryTableSource` in one and `SQLGeneratedTableSource` 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 (12 lines × 11) core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:240— core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:240-251 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:265-276 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:288-299 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:311-322 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:362-373 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:384-395 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:407-418 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:430-441 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:453-464 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:476-487 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:499-510 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:240` 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 after the matched lines, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:279` calls `acos` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:376` 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 (12 lines × 6) core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:32— core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:32-43 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Length.java:32-43 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ltrim.java:29-40 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Reverse.java:29-40 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Trim.java:29-40 | core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ucase.java:32-43 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Length.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Ucase.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 3 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 `core/src/main/java/com/alibaba/druid/sql/visitor/functions/Lcase.java:32` 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) core/src/main/java/com/alibaba/druid/sql/dialect/blink/vsitor/BlinkOutputVisitor.java:62— core/src/main/java/com/alibaba/druid/sql/dialect/blink/vsitor/BlinkOutputVisitor.java:62-73 | core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:164-175 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveOutputVisitor.java:724-735 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:3954-3965 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11501-11512 — there are 5 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 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 `core/src/main/java/com/alibaba/druid/sql/dialect/blink/vsitor/BlinkOutputVisitor.java:62` 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–12 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3048— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3048-3058 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3073-3083 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3172-3182 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3237-3247 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3380-3391 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3048` 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 after the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3060` calls `token`, `nextToken` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:3184` 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–12 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/TDDLHint.java:71— core/src/main/java/com/alibaba/druid/sql/ast/TDDLHint.java:71-82 | core/src/main/java/com/alibaba/druid/sql/ast/TDDLHint.java:88-98 | core/src/main/java/com/alibaba/druid/sql/ast/TDDLHint.java:112-123 | core/src/main/java/com/alibaba/druid/sql/ast/TDDLHint.java:162-173 — 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 `core/src/main/java/com/alibaba/druid/sql/ast/TDDLHint.java:71` 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 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 (10–12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2426— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2426-2435 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2744-2755 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2426` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MySqlShowBinLogEventsStatement` in one and `MySqlShowRelayLogEventsStatement` 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–12 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.java:54— core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.java:54-62 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:4867-4878 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/parser/SQLiteStatementParser.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 (11 lines × 7) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:39— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:39-49 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1124-1134 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1183-1193 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1222-1232 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:37-47 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:87-97 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:136-146 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:39` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:38` calls `setType` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1182` 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 × 6) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2520— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2520-2530 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:2628-2638 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1450-1460 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:1550-1560 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1827-1837 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:1927-1937 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `x` to `OracleCreatePackageStatement` in one and `OracleCreateTypeStatement` 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–11 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8223— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8223-8233 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8306-8316 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:991-999 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:2798-2806 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerStatementParser.java:683-691 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:991` 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–11 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:495— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:495-503 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9880-9890 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12472-12482 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:495` 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 `x` to `SQLCreateProcedureStatement` in one and `SQLCreateFunctionStatement` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:12470` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:494` 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 (3–11 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:289— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:289-299 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:315-325 | core/src/main/java/com/alibaba/druid/util/StringUtils.java:357-359 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 262 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 × 10) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:39— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:39-48 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:160-169 | core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:185-194 | core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:216-225 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1124-1133 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1183-1192 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1222-1231 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarCreateTableParser.java:37-46 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:87-96 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGCreateTableParser.java:136-145 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmCreateTableParser.java:38` calls `setType` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:1182` 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 (10 lines × 9) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1703— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1703-1713 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2513-2523 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2536-2546 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2640-2650 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2689-2698 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2843-2853 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2887-2897 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3435-3445 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10271-10281 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1703` 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 first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MySqlShowStatusStatement` in one and `MySqlShowEventsStatement` 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 (10 lines × 8) REDACTED:86— REDACTED:86-95 | REDACTED:106-115 | core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:71-80 | core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java:91-100 | REDACTED:73-82 | REDACTED:93-102 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:70-79 | core/src/main/java/com/alibaba/druid/support/jakarta/StatViewFilter.java:90-99 — before extracting anything, compare `REDACTED` and `core/src/main/java/com/alibaba/druid/support/http/StatViewFilter.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 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 `REDACTED:86` 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–10 lines × 2) core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:810— core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:810-819 | core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:833-839 — 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 `core/src/main/java/com/alibaba/druid/support/http/stat/WebAppStat.java:810` 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 × 10) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1702— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1702-1710 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2512-2520 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2535-2543 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2639-2647 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2688-2696 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2842-2850 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2886-2894 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:3434-3442 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10216-10224 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10270-10278 — there are 10 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 10 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 `x` to `MySqlShowStatusStatement` in one and `MySqlShowEventsStatement` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10226` calls `isExtra`, `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:1712` 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–9 lines × 7) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1477— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1477-1485 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1504-1510 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2230-2238 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2257-2263 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2723-2731 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2750-2756 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:596-602 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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 `x` to `SQLIfStatement.ElseIf` in one and `SQLIfStatement` 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, `core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerOutputVisitor.java:604` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1486` 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–9 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6054— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6054-6061 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6069-6076 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6387-6395 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6402-6410 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6417-6425 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:6387` 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.
Duplicated block (8–9 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2634— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2634-2642 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:2881-2889 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7197-7204 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:10383-10391 — 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 `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7197` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `MySqlShowOpenTablesStatement` in one and `MySqlShowTriggersStatement` 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–9 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8631— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8631-8637 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8641-8649 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/parser/OracleStatementParser.java:1185-1191 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:8631` 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 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 (11–17 lines × 3) core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:288— core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:288-298 | core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:301-317 | core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:320-336 — 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 `core/src/main/java/com/alibaba/druid/stat/JdbcStatManager.java:288` 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–9 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:468— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:468-476 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:497-503 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:497` 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 × 2) core/src/main/java/com/alibaba/druid/util/ListDG.java:144— core/src/main/java/com/alibaba/druid/util/ListDG.java:144-152 | core/src/main/java/com/alibaba/druid/util/ListDG.java:165-172 — 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 `core/src/main/java/com/alibaba/druid/util/ListDG.java:144` 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–8 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:93— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:93-100 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1475-1481 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:555-561 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:247-254 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:434-441 | core/src/main/java/com/alibaba/druid/sql/dialect/spark/parser/SparkExprParser.java:65-72 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 294 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.java:1475` 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 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, `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/parser/CKExprParser.java:89` calls `primary`, `primaryRest` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:245` 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–8 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:168— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:168-175 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:244-251 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:337-343 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:364-370 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:9239-9245 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java:168` 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–8 lines × 4) core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1649— core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1649-1656 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1670-1677 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1688-1695 | core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1703-1709 — 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 `core/src/main/java/com/alibaba/druid/util/MySqlUtils.java:1649` 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–8 lines × 3) core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:807— core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:807-814 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:994-1000 | core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:1050-1056 — 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 `core/src/main/java/com/alibaba/druid/sql/parser/SQLParserUtils.java:807` 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.
Duplicated block (7 lines × 8) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403-409 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4245-4251 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4262-4268 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4337-4343 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4407-4413 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7729-7735 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7799-7807 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11697-11704 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403` 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: the declarations holding them bind `x` to `SQLIfStatement` in one and `SQLIfStatement.ElseIf` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11706` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4253` 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 (7 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:194— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java:194-200 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:266-273 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:298-305 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:461-468 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/parser/PGExprParser.java:493-500 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmExprParser.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 203 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 (6–7 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:60— core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:60-65 | core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftSelectParser.java:47-53 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerSelectParser.java:137-143 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/parser/DmSelectParser.java:60` 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.
Duplicated block (6 lines × 10) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403-408 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4245-4250 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4262-4267 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4337-4342 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4366-4371 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4407-4412 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7729-7734 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7799-7805 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:9150-9155 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11697-11702 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 148 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryOutputVisitor.java:403` 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: the declarations holding them bind `x` to `SQLIfStatement` in one and `SQLIfStatement.ElseIf` 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, `core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11706` calls `print0` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4253` 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 × 6) core/src/main/java/com/alibaba/druid/wall/WallFilter.java:326— core/src/main/java/com/alibaba/druid/wall/WallFilter.java:326-331 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:343-348 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:361-366 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:380-385 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:398-403 | core/src/main/java/com/alibaba/druid/wall/WallFilter.java:415-420 — 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 `core/src/main/java/com/alibaba/druid/wall/WallFilter.java:326` 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 × 8) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4242— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4242-4246 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4259-4263 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4334-4338 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4404-4408 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:1428-1433 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7726-7730 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:7795-7800 | core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java:11693-11698 — there are 8 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 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4242` 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 `x` to `SQLIfStatement.ElseIf` in one and `SQLIfStatement.Else` 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 before the matched lines, `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4239` calls `print0`, `getCondition`, `accept` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java:4257` 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 (5 lines × 7) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:670— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:670-674 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:676-680 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:682-686 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:688-692 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:694-698 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:700-704 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:706-710 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:670` 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 (4–5 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:305— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:305-310 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:331-336 | core/src/main/java/com/alibaba/druid/util/StringUtils.java:362-365 | core/src/main/java/com/alibaba/druid/util/StringUtils.java:374-378 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java` and `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 262 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 `core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDateExpr.java:305` 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.
Duplicated block (2–5 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5266— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5266-5267 | core/src/main/java/com/alibaba/druid/sql/dialect/odps/parser/OdpsExprParser.java:208-209 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:1303-1306 | core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java:5059-5061 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2801-2805 | core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:5080-5085 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5266` 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 after the matched lines, `core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.java:2805` calls `stringVal` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5267` does not — after which the two agree again for 5 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 (37 lines × 23) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterProcedureStatement.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterProcedureStatement.java:1-105 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterSystemGetConfigStatement.java:1-39 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowCreateViewStatement.java:1-50 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCreateFunctionStatement.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCreateProcedureStatement.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCreateTriggerStatement.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowEngineStatement.java:1-46 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowFunctionCodeStatement.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowHMSMetaStatement.java:1-49 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowPartitionsStatement.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowProcedureCodeStatement.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterPackageStatement.java:1-57 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSummaryStatement.java:1-48 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSynonymStatement.java:1-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTableDropPartition.java:1-38 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTableMoveTablespace.java:1-38 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTableTruncatePartition.java:1-38 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTriggerStatement.java:1-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterViewStatement.java:1-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleCreateTableSpaceStatement.java:1-38 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleDropDbLinkStatement.java:1-49 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleDropPackageStatement.java:1-38 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleSetTransactionStatement.java:1-57 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCreateFunctionStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCreateProcedureStatement.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. 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterProcedureStatement.java:1` 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 (29 lines × 13) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAnalyzePartition.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAnalyzePartition.java:1-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableArchivePartition.java:1-44 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableCheckPartition.java:1-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDiscardPartition.java:30-58 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropPartition.java:1-63 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableImportPartition.java:1-55 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableMergePartition.java:1-75 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableOptimizePartition.java:1-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableReOrganizePartition.java:1-52 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableRebuildPartition.java:1-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableRecoverPartitions.java:1-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableRepairPartition.java:1-45 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableUnarchivePartition.java:1-44 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAnalyzePartition.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableArchivePartition.java` as WHOLE FILES: 84% 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAnalyzePartition.java:1` 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 (30 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableArchive.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableArchive.java:1-37 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDisableLifecycle.java:1-37 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableEnableLifecycle.java:1-37 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTablePartition.java:1-30 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableArchive.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDisableLifecycle.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. 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableArchive.java:1` 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 (38 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDisableConstraint.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDisableConstraint.java:1-39 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropConstraint.java:1-67 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableEnableConstraint.java:1-39 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableValidateConstraint.java:1-38 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDisableConstraint.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropConstraint.java` as WHOLE FILES: 93% 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDisableConstraint.java:1` 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 (75 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddColumn.java:36— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddColumn.java:36-111 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableReplaceColumn.java:1-75 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddColumn.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableReplaceColumn.java` as WHOLE FILES: 98% 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. 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableReplaceColumn.java:1` 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 (42 lines × 8) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropCatalogStatement.java:30— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropCatalogStatement.java:30-88 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropEventStatement.java:31-72 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropMaterializedViewStatement.java:31-72 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropOutlineStatement.java:31-72 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropResourceGroupStatement.java:32-73 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropResourceStatement.java:31-72 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropServerStatement.java:29-79 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropTypeStatement.java:29-84 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropCatalogStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropEventStatement.java` as WHOLE FILES: 84% 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. 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 (60 lines × 2) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropOfflineModelStatement.java:29— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropOfflineModelStatement.java:29-88 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropTableGroupStatement.java:29-93 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropOfflineModelStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropTableGroupStatement.java` as WHOLE FILES: 91% 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. 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 (51 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropCatalogStatement.java:30— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropCatalogStatement.java:30-88 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropServerStatement.java:29-79 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropTypeStatement.java:29-84 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropCatalogStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropServerStatement.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 177 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 (31 lines × 7) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateRoleStatement.java:31— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateRoleStatement.java:31-74 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropOfflineModelStatement.java:29-88 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropRoleStatement.java:29-81 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropTableGroupStatement.java:29-93 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropTriggerStatement.java:30-82 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLReleaseSavePointStatement.java:30-60 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLSavePointStatement.java:30-60 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLCreateRoleStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropRoleStatement.java` as WHOLE FILES: 84% 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. 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 (54 lines × 3) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowCatalogsStatement.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowCatalogsStatement.java:1-54 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowFunctionsStatement.java:1-64 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowSessionStatement.java:1-54 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowCatalogsStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowFunctionsStatement.java` as WHOLE FILES: 94% 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowCatalogsStatement.java:1` 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 (34 lines × 10) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterOutlineStatement.java:34— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterOutlineStatement.java:34-91 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropCatalogStatement.java:30-88 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropEventStatement.java:31-72 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropMaterializedViewStatement.java:31-72 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropOutlineStatement.java:31-72 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropResourceGroupStatement.java:32-73 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropResourceStatement.java:31-72 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropServerStatement.java:29-79 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDropTypeStatement.java:29-84 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowCreateMaterializedViewStatement.java:30-63 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterOutlineStatement.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowCreateMaterializedViewStatement.java` as WHOLE FILES: 91% 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. 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 (69 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7-75 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitorAdapter.java:1-229 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitorAdapter.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 916 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7` 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 (48 lines × 5) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7-75 | core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKASTVisitor.java:13-60 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveASTVisitor.java:29-83 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitorAdapter.java:1-229 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/visitor/PrestoASTVisitor.java:14-66 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveASTVisitor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 687 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7` 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: the declarations holding them bind `x` to `BigQuerySelectQueryBlock` in one and `CKCreateTableStatement` 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 (82 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKExportParameterVisitor.java:39— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKExportParameterVisitor.java:39-120 | core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2ExportParameterVisitor.java:40-125 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGExportParameterVisitor.java:39-120 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKExportParameterVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2ExportParameterVisitor.java` as WHOLE FILES: 90% 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 `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKExportParameterVisitor.java:39` 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 (99 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2EvalVisitor.java:36— core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2EvalVisitor.java:36-134 | core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2EvalVisitor.java:36-134 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleEvalVisitor.java:36-134 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGEvalVisitor.java:36-139 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlite/visitor/SQLiteEvalVisitor.java:21-119 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/SQLServerEvalVisitor.java:36-134 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2EvalVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2EvalVisitor.java` as WHOLE FILES: 93% 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.
Duplicated block (50 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmASTVisitor.java:9— core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmASTVisitor.java:9-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarASTVisitor.java:24-121 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitor.java:26-270 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmASTVisitor.java:9` 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: the declarations holding them bind `x` to `DmSelectQueryBlock` in one and `OscarSelectQueryBlock` 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 (53 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7— core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7-75 | core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveASTVisitor.java:29-83 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitorAdapter.java:1-229 | core/src/main/java/com/alibaba/druid/sql/dialect/presto/visitor/PrestoASTVisitor.java:14-66 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/hive/visitor/HiveASTVisitor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 687 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 `core/src/main/java/com/alibaba/druid/sql/dialect/bigquery/visitor/BigQueryVisitor.java:7` 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: the declarations holding them bind `x` to `BigQuerySelectQueryBlock` in one and `HiveInsert` 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 (28 lines × 6) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsCancelDDLJob.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsCancelDDLJob.java:1-28 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsClearDDLJobCache.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsRecoverDDLJob.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsRemoveDDLJob.java:1-46 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsRollbackDDLJob.java:1-28 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsShowDDLJobs.java:1-37 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsCancelDDLJob.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsClearDDLJobCache.java` as WHOLE FILES: 84% 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsCancelDDLJob.java:1` 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 (59 lines × 11) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowBroadcastsStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowBroadcastsStatement.java:1-59 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowDatasourcesStatement.java:1-59 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowDdlStatusStatement.java:1-62 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowDsStatement.java:1-59 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowHelpStatement.java:1-59 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowNodeStatement.java:1-59 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowRuleStatement.java:32-90 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowRuleStatusStatement.java:1-86 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowSequencesStatement.java:1-59 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowSlowStatement.java:1-77 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowTraceStatement.java:1-59 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowBroadcastsStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowDatasourcesStatement.java` as WHOLE FILES: 97% 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowBroadcastsStatement.java:1` 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 (47 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCharacterSetStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCharacterSetStatement.java:1-56 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCollationStatement.java:1-47 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCharacterSetStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCollationStatement.java` as WHOLE FILES: 94% 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowCharacterSetStatement.java:1` 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 (35 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowConfigStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowConfigStatement.java:1-38 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlAlterFullTextStatement.java:1-50 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlDropFullTextStatement.java:1-36 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowCreateFullTextStatement.java:1-35 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowConfigStatement.java:1` 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 (46 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowErrorsStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowErrorsStatement.java:1-46 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowWarningsStatement.java:1-46 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowErrorsStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowWarningsStatement.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. 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowErrorsStatement.java:1` 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 (42 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowVariantsStatement.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowVariantsStatement.java:1-67 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowFunctionStatusStatement.java:1-47 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowProcedureStatusStatement.java:1-47 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowStatusStatement.java:28-69 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowVariantsStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowStatusStatement.java` as WHOLE FILES: 86% 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLShowVariantsStatement.java:1` 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 (57 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowOpenTablesStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowOpenTablesStatement.java:1-57 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowTriggersStatement.java:1-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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowOpenTablesStatement.java:1` 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 (32 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsShowDDLJobs.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsShowDDLJobs.java:1-37 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlShowPhysicalProcesslistStatement.java:1-34 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowHtcStatement.java:1-32 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowStcStatement.java:1-32 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowHtcStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowStcStatement.java` as WHOLE FILES: 95% 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. 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 `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/DrdsShowDDLJobs.java:1` 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 (35 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlAlterFullTextStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlAlterFullTextStatement.java:1-50 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlDropFullTextStatement.java:1-36 | core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlShowCreateFullTextStatement.java:1-35 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MysqlAlterFullTextStatement.java:1` 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 (48 lines × 6) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterProcedureStatement.java:1— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterProcedureStatement.java:1-105 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterPackageStatement.java:1-57 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSummaryStatement.java:1-48 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSynonymStatement.java:1-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTriggerStatement.java:1-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterViewStatement.java:1-58 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSummaryStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSynonymStatement.java` as WHOLE FILES: 94% 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. 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterProcedureStatement.java:1` 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 (58 lines × 3) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSynonymStatement.java:1— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSynonymStatement.java:1-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTriggerStatement.java:1-58 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterViewStatement.java:1-58 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSynonymStatement.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTriggerStatement.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 268 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterSynonymStatement.java:1` 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 (44 lines × 4) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddColumn.java:36— core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddColumn.java:36-111 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableDropColumnItem.java:32-76 | core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableReplaceColumn.java:1-75 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleAlterTableModify.java:1-44 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAddColumn.java` and `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableReplaceColumn.java` as WHOLE FILES: 98% 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. 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 `core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableReplaceColumn.java:1` 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 (98 lines × 2) core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarASTVisitor.java:24— core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarASTVisitor.java:24-121 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGASTVisitor.java:26-270 — 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 `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarASTVisitor.java:24` 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: the declarations holding them bind `x` to `OscarSelectQueryBlock` in one and `PGSelectQueryBlock` 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 (75 lines × 4) core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKExportParameterVisitor.java:39— core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKExportParameterVisitor.java:39-120 | core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2ExportParameterVisitor.java:40-125 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGExportParameterVisitor.java:39-120 | core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/visitor/MSSQLServerExportParameterVisitor.java:38-112 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKExportParameterVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/db2/visitor/DB2ExportParameterVisitor.java` as WHOLE FILES: 90% 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 `core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKExportParameterVisitor.java:39` 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 (43 lines × 2) core/src/main/java/com/alibaba/druid/support/clickhouse/BalancedClickhouseDriver.java:16— core/src/main/java/com/alibaba/druid/support/clickhouse/BalancedClickhouseDriver.java:16-58 | core/src/main/java/com/alibaba/druid/support/clickhouse/BalancedClickhouseDriverNative.java:16-58 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/support/clickhouse/BalancedClickhouseDriver.java` and `core/src/main/java/com/alibaba/druid/support/clickhouse/BalancedClickhouseDriverNative.java` as WHOLE FILES: 83% 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. 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: `BalancedClickhouseDataSource` names `com.github.housepower.jdbc.BalancedClickhouseDataSource` in one and `ru.yandex.clickhouse.BalancedClickhouseDataSource` 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 (54 lines × 2) core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorCluster.java:1— core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorCluster.java:1-54 | core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorInstance.java:1-92 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorCluster.java` and `core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorInstance.java` as WHOLE FILES: 97% 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. 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 `core/src/main/java/com/alibaba/druid/support/monitor/entity/MonitorCluster.java:1` 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 (61 lines × 3) druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceBuilder.java:1— druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceBuilder.java:1-61 | druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/DruidDataSourceBuilder.java:1-61 | druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceBuilder.java:1-61 — before extracting anything, compare `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceBuilder.java` and `druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/DruidDataSourceBuilder.java` as WHOLE FILES: 98% 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. Read the line range as the matched WINDOW rather than a finished unit: at `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/DruidDataSourceBuilder.java:1` 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 (197 lines × 3) druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/properties/DruidStatProperties.java:1— druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/properties/DruidStatProperties.java:1-197 | druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/properties/DruidStatProperties.java:1-197 | druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/properties/DruidStatProperties.java:1-197 — before extracting anything, compare `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/properties/DruidStatProperties.java` and `druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/properties/DruidStatProperties.java` as WHOLE FILES: 99% 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. Read the line range as the matched WINDOW rather than a finished unit: at `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/properties/DruidStatProperties.java:1` 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 (108 lines × 3) druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidFilterConfiguration.java:1— druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidFilterConfiguration.java:1-108 | druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/stat/DruidFilterConfiguration.java:1-108 | druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/stat/DruidFilterConfiguration.java:1-108 — before extracting anything, compare `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidFilterConfiguration.java` and `druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/stat/DruidFilterConfiguration.java` as WHOLE FILES: 98% 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. Read the line range as the matched WINDOW rather than a finished unit: at `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidFilterConfiguration.java:1` 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 (48 lines × 3) druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidSpringAopConfiguration.java:1— druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidSpringAopConfiguration.java:1-48 | druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/stat/DruidSpringAopConfiguration.java:1-48 | druid-spring-boot-starter/src/main/java/com/alibaba/druid/spring/boot/autoconfigure/stat/DruidSpringAopConfiguration.java:1-48 — before extracting anything, compare `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidSpringAopConfiguration.java` and `druid-spring-boot-4-starter/src/main/java/com/alibaba/druid/spring/boot4/autoconfigure/stat/DruidSpringAopConfiguration.java` as WHOLE FILES: 95% 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. Read the line range as the matched WINDOW rather than a finished unit: at `druid-spring-boot-3-starter/src/main/java/com/alibaba/druid/spring/boot3/autoconfigure/stat/DruidSpringAopConfiguration.java:1` 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 first that the copies are not typed on the same thing: `DruidStatProperties` names `com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties` in one and `com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties` 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 × 16) core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBigIntExpr.java:71— core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLBigIntExpr.java:71-76 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLDecimalExpr.java:71-76 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLSmallIntExpr.java:74-79 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTimestampNTZExpr.java:151-156 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTinyIntExpr.java:74-79 | core/src/main/java/com/alibaba/druid/sql/ast/expr/SQLTypeExpr.java:76-81 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleBinaryDoubleExpr.java:58-63 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/expr/OracleBinaryFloatExpr.java:71-76 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGBoxExpr.java:68-73 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGCidrExpr.java:68-73 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGCircleExpr.java:59-64 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGInetExpr.java:68-73 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGLineSegmentsExpr.java:59-64 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGMacAddrExpr.java:68-73 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGPointExpr.java:68-73 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGPolygonExpr.java:68-73 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGBoxExpr.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGCidrExpr.java` as WHOLE FILES: 92% 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. 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 × 6) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:445— core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:445-453 | core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:455-463 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2038-2046 | core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java:2049-2057 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2531-2539 | core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2542-2550 — before extracting anything, compare `core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java` and `core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1096 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. 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 `x` to `CheckOption` in one and `ReadOnly` 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 × 11) core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:129— core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:129-134 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:185-190 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:225-230 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:233-238 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:241-246 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:572-577 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:612-617 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:620-625 | core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:628-633 | core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:235-240 | core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java:243-248 — there are 11 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 11 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.
End-of-life framework: Spring Boot 2 REDACTED:1— REDACTED depends on `org.springframework.boot` at a version that pins Spring Boot 2, and Spring Boot 2.x, open-source support ended 2023-11-24. The constraint cannot admit a different major, so this repository stays on it until the declaration is edited. An end-of-life framework receives no further releases, including security releases.
Off the main sequence: druid — druid: abstractness 0.14, instability 0.00, distance 0.86 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
Skeleton type — most members are unfinished core/src/main/java/com/alibaba/druid/sql/dialect/mysql/executor/MySqlProcedureExecutor.java:25— `MySqlProcedureExecutor` has 12 unfinished members out of 12 declared methods (whether or not each carries a body) — a scaffolded class that was never implemented.
P12 · CI test-gate honesty· Coverage collected but not gated · ×1
Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
Outbound HTTP without resilience druid-admin/src/main/java/com/alibaba/druid/admin/util/HttpUtil.java:22— `HttpClients.createDefault(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Wholesale file copy (332 identical lines × 2 files) core/src/main/resources/support/http/resources/js/lang.js:1— core/src/main/resources/support/http/resources/js/lang.js:1 · druid-admin/src/main/resources/support/http/resources/js/lang.js:1 — these 2 files are line-for-line copies of one another — 332 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (129 identical lines × 2 files) core/src/main/resources/support/http/resources/js/common.js:1— core/src/main/resources/support/http/resources/js/common.js:1 · druid-admin/src/main/resources/support/http/resources/js/common.js:1 — these 2 files are line-for-line copies of one another — 129 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (94 identical lines × 2 files) REDACTED:5— REDACTED:5 · REDACTED:5 — these 2 files are line-for-line copies of one another — 94 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Orphaned file core/src/main/java/com/alibaba/druid/pool/ha/HighAvailableDataSource.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/util/ConcurrentLruCache.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/stat/DruidStatService.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/pool/ha/selector/RandomDataSourceValidateThread.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/pool/ha/node/ZookeeperNodeListener.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/pool/ha/selector/RandomDataSourceSelector.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarSelectParser.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbCreateTableParser.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/pool/ha/node/PoolUpdater.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/pool/DruidStatementConnection.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbExprParser.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/impala/parser/ImpalaCreateTableParser.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/impala/visitor/ImpalaOutputVisitor.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/parser/GaussDbStatementParser.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxyImpl.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarLexer.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/presto/parser/PrestoSelectParser.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file druid-admin/src/main/java/com/alibaba/druid/admin/model/dto/DataSourceResult.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/pool/vendor/OceanBaseOracleExceptionSorter.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarSelectQueryBlock.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/pool/ha/node/ZookeeperNodeRegister.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/stmt/OscarInsertStatement.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Duplicated predicate core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java:889— `!isAllowComment() && !isSafeComment(stringVal)` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlLexer.java, core/src/main/java/com/alibaba/druid/sql/parser/Lexer.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 REDACTED:276— `"0:0:0:0:0:0:0:1".equals(remoteAddress) || (denyList.isEmpty() && allowList.isEmpty())` appears character-identically in 2 files — REDACTED, REDACTED. 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 core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:2417— `(!bracket) && left instanceof SQLUnionQuery && ((SQLUnionQuery) left).getOperator() == operator && !right.isParenthesized() && x.getOrderBy(…` appears character-identically in 3 files — core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java, core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.java, core/src/main/java/com/alibaba/druid/wall/spi/WallVisitorUtils.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 core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java:73— `(!isParameterized()) && isPrettyFormat() && x.hasBeforeComment()` appears character-identically in 5 files — core/src/main/java/com/alibaba/druid/sql/dialect/dm/visitor/DmOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.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 core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java:256— `(!leftUnion.isParenthesized()) && leftUnion.getOrderBy() == null && (!leftLeft.isParenthesized()) && (!leftRight.isParenthesized()) && leftL…` appears character-identically in 5 files — core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnionQuery.java, core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java, core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.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 core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeLexer.java:220— `(ch == '/' && charAt(pos + 1) == '/') || (ch == '-' && charAt(pos + 1) == '-')` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/snowflake/SnowflakeLexer.java, core/src/main/java/com/alibaba/druid/sql/parser/Lexer.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 core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2312— `(dataTypeName.startsWith("TABLE OF") && x.getDefaultValue() == null) || dataTypeName.equalsIgnoreCase("REF CURSOR") || dataTypeName.startsWi…` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.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 core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java:1334— `(op == SQLBinaryOperator.BooleanAnd || op == SQLBinaryOperator.BooleanOr) && left instanceof SQLBinaryOpExpr && ((SQLBinaryOpExpr) left).get…` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/repository/SchemaResolveVisitorFactory.java, core/src/main/java/com/alibaba/druid/sql/visitor/SchemaStatVisitor.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 core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java:1287— `(parent instanceof SQLStatement && !(parent instanceof OracleForStatement)) || (parent instanceof SQLSelectItem && (parent.getParent() insta…` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/odps/visitor/OdpsOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.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 core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java:488— `(x.getAlias() != null) && (x.getAlias().length() != 0)` appears character-identically in 3 files — core/src/main/java/com/alibaba/druid/sql/dialect/oracle/visitor/OracleOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/dialect/oscar/visitor/OscarOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.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 core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java:171— `1 == ((SQLMethodInvokeExpr) expr).getArguments().size() && ((SQLMethodInvokeExpr) expr).getArguments().get(0) instanceof SQLIntegerExpr` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLUnique.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlTableIndex.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 core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2349— `DbType.mysql == dbType && x.getParent() instanceof SQLCreateFunctionStatement` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.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 core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java:2296— `DbType.oracle == dbType || dataType instanceof OracleFunctionDataType || dataType instanceof OracleProcedureDataType` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/visitor/PGOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.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 core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:186— `FnvHash.Constants.CURDATE == hash_lower && ident.charAt(0) != '`' && lexer.token() != Token.LPAREN` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:171— `FnvHash.Constants.CURRENT_DATE == hash_lower && ident.charAt(0) != '`' && lexer.token() != Token.LPAREN` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:181— `FnvHash.Constants.CURRENT_TIME == hash_lower && ident.charAt(0) != '`' && lexer.token() != Token.LPAREN` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:176— `FnvHash.Constants.CURRENT_TIMESTAMP == hash_lower && ident.charAt(0) != '`' && lexer.token() != Token.LPAREN` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:163— `FnvHash.Constants.DATETIME == hash_lower && lexer.stringVal().charAt(0) != '`' && lexer.token() == Token.LITERAL_CHARS` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:191— `FnvHash.Constants.LOCALTIME == hash_lower && ident.charAt(0) != '`' && lexer.token() != Token.LPAREN` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:196— `FnvHash.Constants.LOCALTIMESTAMP == hash_lower && ident.charAt(0) != '`' && lexer.token() != Token.LPAREN` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java:135— `FnvHash.Constants.TIMESTAMP == hash_lower && lexer.stringVal().charAt(0) != '`' && lexer.token() == Token.LITERAL_CHARS` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/hive/parser/HiveExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlExprParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java:263— `JdbcUtils.isPgsqlDbType(dbType) && x.getParent() instanceof SQLAlterTableAlterColumn` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/visitor/StarRocksOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.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 .mvn/wrapper/MavenWrapperDownloader.java:97— `System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null` appears character-identically in 2 files — .mvn/wrapper/MavenWrapperDownloader.java, druid-demo-petclinic/.mvn/wrapper/MavenWrapperDownloader.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 core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java:5267— `alias.length() > 2 && alias.charAt(0) == '"' && alias.charAt(alias.length() - 1) == '"'` appears character-identically in 3 files — core/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlStatementParser.java, core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java, core/src/main/java/com/alibaba/druid/sql/parser/SQLStatementParser.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 core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java:323— `beforeComments != null && !beforeComments.isEmpty() && isPrettyFormat()` appears character-identically in 2 files — core/src/main/java/com/alibaba/druid/sql/dialect/clickhouse/visitor/CKOutputVisitor.java, core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.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.
+ 15 more in this group — see findings.md.
P10 · Library API & versioning· Implementation type on the public API · ×30
Implementation type on the public API core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:36— 1 public type in `com.alibaba.druid.filter` is marked as implementation by its own namespace, folder or name: `FilterChainImpl` (core/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java:36, 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 core/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java:37— 1 public type in `com.alibaba.druid.mock.handler` is marked as implementation by its own namespace, folder or name: `MySqlMockExecuteHandlerImpl` (core/src/main/java/com/alibaba/druid/mock/handler/MySqlMockExecuteHandlerImpl.java:37, 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 core/src/main/java/com/alibaba/druid/pool/DruidDataSourceStatLoggerImpl.java:34— 1 public type in `com.alibaba.druid.pool` is marked as implementation by its own namespace, folder or name: `DruidDataSourceStatLoggerImpl` (core/src/main/java/com/alibaba/druid/pool/DruidDataSourceStatLoggerImpl.java:34, 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 core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:30— 12 public types in `com.alibaba.druid.proxy.jdbc` are marked as implementation by their own namespace, folder or name: `CallableStatementProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/CallableStatementProxyImpl.java:30, name ends in `Impl`), `ClobProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/ClobProxyImpl.java:31, name ends in `Impl`), `ConnectionProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/ConnectionProxyImpl.java:30, name ends in `Impl`), `DataSourceProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/DataSourceProxyImpl.java:39, name ends in `Impl`), `DatabaseMetaDataProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/DatabaseMetaDataProxyImpl.java:23, name ends in `Impl`), `JdbcParameterImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/JdbcParameterImpl.java:20, name ends in `Impl`), `NClobProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/NClobProxyImpl.java:20, name ends in `Impl`), `PreparedStatementProxyImpl` (core/src/main/java/com/alibaba/druid/proxy/jdbc/PreparedStatementProxyImpl.java:34, name ends in `Impl`), and 4 more. 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 core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:29— 4 public types in `com.alibaba.druid.sql.ast` are marked as implementation by their own namespace, folder or name: `SQLDataTypeImpl` (core/src/main/java/com/alibaba/druid/sql/ast/SQLDataTypeImpl.java:29, name ends in `Impl`), `SQLExprImpl` (core/src/main/java/com/alibaba/druid/sql/ast/SQLExprImpl.java:20, name ends in `Impl`), `SQLObjectImpl` (core/src/main/java/com/alibaba/druid/sql/ast/SQLObjectImpl.java:31, name ends in `Impl`), `SQLStatementImpl` (core/src/main/java/com/alibaba/druid/sql/ast/SQLStatementImpl.java:26, 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 core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLConstraintImpl.java:25— 4 public types in `com.alibaba.druid.sql.ast.statement` are marked as implementation by their own namespace, folder or name: `SQLConstraintImpl` (core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLConstraintImpl.java:25, name ends in `Impl`), `SQLForeignKeyImpl` (core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLForeignKeyImpl.java:24, name ends in `Impl`), `SQLPrimaryKeyImpl` (core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLPrimaryKeyImpl.java:20, name ends in `Impl`), `SQLTableSourceImpl` (core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSourceImpl.java:28, 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 core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLBuilderImpl.java:23— 4 public types in `com.alibaba.druid.sql.builder.impl` are marked as implementation by their own namespace, folder or name: `SQLBuilderImpl` (core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLBuilderImpl.java:23, `impl`), `SQLDeleteBuilderImpl` (core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLDeleteBuilderImpl.java:33, `impl`), `SQLSelectBuilderImpl` (core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLSelectBuilderImpl.java:31, `impl`), `SQLUpdateBuilderImpl` (core/src/main/java/com/alibaba/druid/sql/builder/impl/SQLUpdateBuilderImpl.java:36, `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 core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/DB2StatementImpl.java:23— 1 public type in `com.alibaba.druid.sql.dialect.db2.ast` is marked as implementation by its own namespace, folder or name: `DB2StatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/db2/ast/DB2StatementImpl.java:23, 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 core/src/main/java/com/alibaba/druid/sql/dialect/dm/ast/DmObjectImpl.java:7— 1 public type in `com.alibaba.druid.sql.dialect.dm.ast` is marked as implementation by its own namespace, folder or name: `DmObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/dm/ast/DmObjectImpl.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.
Implementation type on the public API core/src/main/java/com/alibaba/druid/sql/dialect/doris/ast/DorisObjectImpl.java:6— 1 public type in `com.alibaba.druid.sql.dialect.doris.ast` is marked as implementation by its own namespace, folder or name: `DorisObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/doris/ast/DorisObjectImpl.java:6, 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 core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/ast/GaussDbObjectImpl.java:7— 1 public type in `com.alibaba.druid.sql.dialect.gaussdb.ast` is marked as implementation by its own namespace, folder or name: `GaussDbObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/ast/GaussDbObjectImpl.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.
Implementation type on the public API core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlIndexHintImpl.java:25— 2 public types in `com.alibaba.druid.sql.dialect.mysql.ast` are marked as implementation by their own namespace, folder or name: `MySqlIndexHintImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlIndexHintImpl.java:25, name ends in `Impl`), `MySqlObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/MySqlObjectImpl.java:22, 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 core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/expr/MySqlExprImpl.java:22— 1 public type in `com.alibaba.druid.sql.dialect.mysql.ast.expr` is marked as implementation by its own namespace, folder or name: `MySqlExprImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/expr/MySqlExprImpl.java:22, 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 core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlStatementImpl.java:26— 1 public type in `com.alibaba.druid.sql.dialect.mysql.ast.statement` is marked as implementation by its own namespace, folder or name: `MySqlStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlStatementImpl.java:26, 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 core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlEvalVisitorImpl.java:28— 1 public type in `com.alibaba.druid.sql.dialect.mysql.visitor` is marked as implementation by its own namespace, folder or name: `MySqlEvalVisitorImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/mysql/visitor/MySqlEvalVisitorImpl.java:28, 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 core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsObjectImpl.java:23— 2 public types in `com.alibaba.druid.sql.dialect.odps.ast` are marked as implementation by their own namespace, folder or name: `OdpsObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsObjectImpl.java:23, name ends in `Impl`), `OdpsStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/odps/ast/OdpsStatementImpl.java:23, 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 core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OracleSQLObjectImpl.java:25— 2 public types in `com.alibaba.druid.sql.dialect.oracle.ast` are marked as implementation by their own namespace, folder or name: `OracleSQLObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OracleSQLObjectImpl.java:25, name ends in `Impl`), `OracleSegmentAttributesImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OracleSegmentAttributesImpl.java:25, 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 core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleStatementImpl.java:24— 1 public type in `com.alibaba.druid.sql.dialect.oracle.ast.stmt` is marked as implementation by its own namespace, folder or name: `OracleStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleStatementImpl.java:24, 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 core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/OscarObjectImpl.java:22— 1 public type in `com.alibaba.druid.sql.dialect.oscar.ast` is marked as implementation by its own namespace, folder or name: `OscarObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/oscar/ast/OscarObjectImpl.java:22, 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 core/src/main/java/com/alibaba/druid/sql/dialect/phoenix/ast/PhoenixStatementImpl.java:26— 1 public type in `com.alibaba.druid.sql.dialect.phoenix.ast` is marked as implementation by its own namespace, folder or name: `PhoenixStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/phoenix/ast/PhoenixStatementImpl.java:26, 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 core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/PGSQLObjectImpl.java:22— 1 public type in `com.alibaba.druid.sql.dialect.postgresql.ast` is marked as implementation by its own namespace, folder or name: `PGSQLObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/PGSQLObjectImpl.java:22, 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 core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGExprImpl.java:23— 1 public type in `com.alibaba.druid.sql.dialect.postgresql.ast.expr` is marked as implementation by its own namespace, folder or name: `PGExprImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/postgresql/ast/expr/PGExprImpl.java:23, 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 core/src/main/java/com/alibaba/druid/sql/dialect/redshift/stmt/RedshiftObjectImpl.java:6— 1 public type in `com.alibaba.druid.sql.dialect.redshift.stmt` is marked as implementation by its own namespace, folder or name: `RedshiftObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/redshift/stmt/RedshiftObjectImpl.java:6, 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 core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/SQLServerObjectImpl.java:21— 2 public types in `com.alibaba.druid.sql.dialect.sqlserver.ast` are marked as implementation by their own namespace, folder or name: `SQLServerObjectImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/SQLServerObjectImpl.java:21, name ends in `Impl`), `SQLServerStatementImpl` (core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/ast/SQLServerStatementImpl.java:23, 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 core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorImpl.java:26— 1 public type in `com.alibaba.druid.sql.visitor` is marked as implementation by its own namespace, folder or name: `SQLEvalVisitorImpl` (core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorImpl.java:26, 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.
Fat interface: LogFilterMBean (58 abstract methods) core/src/main/java/com/alibaba/druid/filter/logging/LogFilterMBean.java:23— `LogFilterMBean` declares 58 abstract methods: `getConnectionLoggerName`, `getDataSourceLoggerName`, `getResultSetLoggerName`, `getStatementLoggerName`, `getStatementSqlFormatOption`, `isConnectionCloseAfterLogEnabled`, `isConnectionCommitAfterLogEnabled`, `isConnectionConnectAfterLogEnabled`, `isConnectionConnectBeforeLogEnabled`, `isConnectionLogEnabled`, `isConnectionLogErrorEnabled`, `isDataSourceLogEnabled`, `isResultSetCloseAfterLogEnabled`, `isResultSetLogEnabled`, `isResultSetLogErrorEnabled`, `isResultSetNextAfterLogEnabled`, `isResultSetOpenAfterLogEnabled`, `isStatementCloseAfterLogEnabled`, `isStatementCreateAfterLogEnabled`, `isStatementExecuteAfterLogEnabled`, `isStatementExecuteBatchAfterLogEnabled`, `isStatementExecuteQueryAfterLogEnabled`, `isStatementExecuteUpdateAfterLogEnabled`, `isStatementLogEnabled`, `isStatementLogErrorEnabled`, `isStatementParameterSetLogEnabled`, `isStatementPrepareAfterLogEnabled`, `isStatementPrepareCallAfterLogEnabled`, `isStatementSqlPrettyFormat`, `setConnectionCloseAfterLogEnabled`, `setConnectionCommitAfterLogEnabled`, `setConnectionConnectAfterLogEnabled`, `setConnectionConnectBeforeLogEnabled`, `setConnectionLogEnabled`, `setConnectionLogErrorEnabled`, `setConnectionLoggerName`, `setDataSourceLogEnabled`, `setDataSourceLoggerName`, `setResultSetCloseAfterLogEnabled`, `setResultSetLogEnabled`, and 18 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. 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: Filter (491 abstract methods) core/src/main/java/com/alibaba/druid/filter/Filter.java:35— `Filter` declares 491 abstract methods: `callableStatement_getArray`, `callableStatement_getArray`, `callableStatement_getBigDecimal`, `callableStatement_getBigDecimal`, `callableStatement_getBigDecimal`, `callableStatement_getBlob`, `callableStatement_getBlob`, `callableStatement_getBoolean`, `callableStatement_getBoolean`, `callableStatement_getByte`, `callableStatement_getByte`, `callableStatement_getBytes`, `callableStatement_getBytes`, `callableStatement_getCharacterStream`, `callableStatement_getCharacterStream`, `callableStatement_getClob`, `callableStatement_getClob`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDouble`, `callableStatement_getDouble`, `callableStatement_getFloat`, `callableStatement_getFloat`, `callableStatement_getInt`, `callableStatement_getInt`, `callableStatement_getLong`, `callableStatement_getLong`, `callableStatement_getNCharacterStream`, `callableStatement_getNCharacterStream`, `callableStatement_getNClob`, `callableStatement_getNClob`, `callableStatement_getNString`, `callableStatement_getNString`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getRef`, and 451 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 491 declarations carry 294 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 294 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: FilterChain (490 abstract methods) core/src/main/java/com/alibaba/druid/filter/FilterChain.java:35— `FilterChain` declares 490 abstract methods: `callableStatement_getArray`, `callableStatement_getArray`, `callableStatement_getBigDecimal`, `callableStatement_getBigDecimal`, `callableStatement_getBigDecimal`, `callableStatement_getBlob`, `callableStatement_getBlob`, `callableStatement_getBoolean`, `callableStatement_getBoolean`, `callableStatement_getByte`, `callableStatement_getByte`, `callableStatement_getBytes`, `callableStatement_getBytes`, `callableStatement_getCharacterStream`, `callableStatement_getCharacterStream`, `callableStatement_getClob`, `callableStatement_getClob`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDate`, `callableStatement_getDouble`, `callableStatement_getDouble`, `callableStatement_getFloat`, `callableStatement_getFloat`, `callableStatement_getInt`, `callableStatement_getInt`, `callableStatement_getLong`, `callableStatement_getLong`, `callableStatement_getNCharacterStream`, `callableStatement_getNCharacterStream`, `callableStatement_getNClob`, `callableStatement_getNClob`, `callableStatement_getNString`, `callableStatement_getNString`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getObject`, `callableStatement_getRef`, and 450 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 490 declarations carry 295 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 295 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: DruidAbstractDataSourceMBean (77 abstract methods) core/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSourceMBean.java:21— `DruidAbstractDataSourceMBean` declares 77 abstract methods: `getActiveConnectionStackTrace`, `getActiveCount`, `getCachedPreparedStatementAccessCount`, `getCachedPreparedStatementCount`, `getCachedPreparedStatementDeleteCount`, `getCachedPreparedStatementHitCount`, `getCachedPreparedStatementMissCount`, `getCloseCount`, `getClosedPreparedStatementCount`, `getCommitCount`, `getConnectCount`, `getConnectErrorCount`, `getConnectionErrorRetryAttempts`, `getCreateCount`, `getCreateErrorCount`, `getCreateTimespanMillis`, `getCreatedTime`, `getDbType`, `getDefaultCatalog`, `getDefaultReadOnly`, `getDefaultTransactionIsolation`, `getDestroyCount`, `getDriverClassName`, `getDriverMajorVersion`, `getDriverMinorVersion`, `getDupCloseCount`, `getExceptionSorterClassName`, `getFilterClassNames`, `getInitialSize`, `getLoginTimeout`, `getMaxActive`, `getMaxIdle`, `getMaxOpenPreparedStatements`, `getMaxPoolPreparedStatementPerConnectionSize`, `getMaxWait`, `getMaxWaitThreadCount`, `getMinEvictableIdleTimeMillis`, `getMinIdle`, `getName`, `getPoolingCount`, and 37 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. 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: DruidDataSourceC3P0AdapterMBean (24 abstract methods) core/src/main/java/com/alibaba/druid/pool/DruidDataSourceC3P0AdapterMBean.java:20— `DruidDataSourceC3P0AdapterMBean` declares 24 abstract methods: `close`, `getCheckoutTimeout`, `getDataSourceName`, `getDriverClass`, `getIdleConnectionTestPeriod`, `getInitialPoolSize`, `getJdbcUrl`, `getLockQueueLength`, `getMaxIdleTime`, `getMaxPoolSize`, `getMinPoolSize`, `getNumBusyConnections`, `getNumConnections`, `getNumIdleConnections`, `getPreferredTestQuery`, `getProperties`, `getUser`, `getWaitThreadCount`, `isAutoCommitOnClose`, `isEnable`, `isTestConnectionOnCheckin`, `isTestConnectionOnCheckout`, `shrink`, `toString`. 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: DruidDataSourceMBean (33 abstract methods) core/src/main/java/com/alibaba/druid/pool/DruidDataSourceMBean.java:26— `DruidDataSourceMBean` declares 33 abstract methods: `clearStatementCache`, `dump`, `fill`, `fill`, `getActivePeak`, `getActivePeakTime`, `getDiscardCount`, `getErrorCount`, `getLockQueueLength`, `getNotEmptySignalCount`, `getNotEmptyWaitCount`, `getNotEmptyWaitMillis`, `getNotEmptyWaitNanos`, `getNotEmptyWaitThreadCount`, `getObjectName`, `getPoolingPeak`, `getPoolingPeakTime`, `getResetCount`, `getTimeBetweenLogStatsMillis`, `getUrl`, `getVersion`, `getWaitThreadCount`, `isEnable`, `isResetStatEnable`, `isUseGlobalDataSourceStat`, `removeAbandoned`, `resetStat`, `setConnectionProperties`, `setPoolPreparedStatements`, `setResetStatEnable`, `setStatLoggerClassName`, `setTimeBetweenLogStatsMillis`, `shrink`. 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 33 declarations carry 32 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 32 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: ResultSetProxy (25 abstract methods) core/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxy.java:27— `ResultSetProxy` declares 25 abstract methods: `addReadBytesLength`, `addReadStringLength`, `getCloseCount`, `getConstructNano`, `getCursorIndex`, `getFetchRowCount`, `getHiddenColumnCount`, `getHiddenColumns`, `getLogicColumn`, `getOpenInputStreamCount`, `getOpenReaderCount`, `getPhysicalColumn`, `getReadBytesLength`, `getReadStringLength`, `getResultSetRaw`, `getSql`, `getSqlStat`, `getStatementProxy`, `incrementOpenInputStreamCount`, `incrementOpenReaderCount`, `setConstructNano`, `setConstructNano`, `setHiddenColumns`, `setLogicColumnMap`, `setPhysicalColumnMap`. 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 25 declarations carry 24 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 24 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: StatementProxy (18 abstract methods) core/src/main/java/com/alibaba/druid/proxy/jdbc/StatementProxy.java:27— `StatementProxy` declares 18 abstract methods: `getBatchSql`, `getBatchSqlList`, `getConnectionProxy`, `getLastExecuteSql`, `getLastExecuteStartNano`, `getLastExecuteTimeNano`, `getLastExecuteType`, `getParameter`, `getParameters`, `getParametersSize`, `getRawObject`, `getSqlStat`, `isFirstResultSet`, `setLastExecuteStartNano`, `setLastExecuteStartNano`, `setLastExecuteTimeNano`, `setLastExecuteTimeNano`, `setSqlStat`. 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 18 declarations carry 16 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 16 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: SQLTableSource (22 abstract methods) core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLTableSource.java:22— `SQLTableSource` declares 22 abstract methods: `aliasHashCode64`, `clone`, `computeAlias`, `containsAlias`, `findColumn`, `findColumn`, `findTableSource`, `findTableSource`, `findTableSourceWithColumn`, `findTableSourceWithColumn`, `findTableSourceWithColumn`, `findTableSourceWithColumn`, `getAlias`, `getFlashback`, `getHints`, `getPivot`, `getUnpivot`, `resolveColumn`, `setAlias`, `setFlashback`, `setPivot`, `setUnpivot`. 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 22 declarations carry 17 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 17 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: SQLDataType (16 abstract methods) core/src/main/java/com/alibaba/druid/sql/ast/SQLDataType.java:22— `SQLDataType` declares 16 abstract methods: `clone`, `getArguments`, `getDbType`, `getName`, `getWithTimeZone`, `hasKeyLength`, `isInt`, `isNumberic`, `isString`, `isWithLocalTimeZone`, `jdbcType`, `nameHashCode64`, `setDbType`, `setName`, `setWithLocalTimeZone`, `setWithTimeZone`. 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: SQLObject (19 abstract methods) core/src/main/java/com/alibaba/druid/sql/ast/SQLObject.java:23— `SQLObject` declares 19 abstract methods: `accept`, `addAfterComment`, `addAfterComment`, `addBeforeComment`, `addBeforeComment`, `clone`, `containsAttribute`, `getAfterCommentsDirect`, `getAttribute`, `getAttributes`, `getAttributesDirect`, `getBeforeCommentsDirect`, `getParent`, `getParent`, `hasAfterComment`, `hasBeforeComment`, `output`, `putAttribute`, `setParent`. 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 19 declarations carry 16 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 16 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: OracleSegmentAttributes (22 abstract methods) core/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/OracleSegmentAttributes.java:24— `OracleSegmentAttributes` declares 22 abstract methods: `getCompress`, `getCompressLevel`, `getInitrans`, `getLogging`, `getMaxtrans`, `getPctfree`, `getPctincrease`, `getPctused`, `getStorage`, `getTablespace`, `isCompressForOltp`, `setCompress`, `setCompressForOltp`, `setCompressLevel`, `setInitrans`, `setLogging`, `setMaxtrans`, `setPctfree`, `setPctincrease`, `setPctused`, `setStorage`, `setTablespace`. 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: JdbcSqlStatMBean (19 abstract methods) core/src/main/java/com/alibaba/druid/stat/JdbcSqlStatMBean.java:23— `JdbcSqlStatMBean` declares 19 abstract methods: `getConcurrentMax`, `getErrorCount`, `getExecuteBatchSizeMax`, `getExecuteBatchSizeTotal`, `getExecuteCount`, `getExecuteErrorLastTime`, `getExecuteLastStartTime`, `getExecuteMillisMax`, `getExecuteMillisTotal`, `getExecuteNanoSpanMaxOccurTime`, `getExecuteSuccessCount`, `getFetchRowCount`, `getFile`, `getId`, `getName`, `getRunningCount`, `getSql`, `getUpdateCount`, `reset`. 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: Log (16 abstract methods) core/src/main/java/com/alibaba/druid/support/logging/Log.java:18— `Log` declares 16 abstract methods under just 13 distinct name(s): `debug`, `debug`, `error`, `error`, `getDebugCount`, `getErrorCount`, `getInfoCount`, `getWarnCount`, `info`, `isDebugEnabled`, `isErrorEnabled`, `isInfoEnabled`, `isWarnEnabled`, `resetStat`, `warn`, `warn`. 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 16 separate responsibilities: a caller binds to 13 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 16 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: WallConfigMBean (56 abstract methods) core/src/main/java/com/alibaba/druid/wall/WallConfigMBean.java:20— `WallConfigMBean` declares 56 abstract methods: `getDenyFunctions`, `getDenyObjects`, `getDenySchemas`, `getDenyTables`, `getDenyVariants`, `getDir`, `getReadOnlyTables`, `init`, `isCommentAllow`, `isDeleteAllow`, `isDeleteWhereAlwayTrueCheck`, `isDenyFunction`, `isDenyObjects`, `isDenySchema`, `isFunctionCheck`, `isInited`, `isInsertAllow`, `isMergeAllow`, `isMultiStatementAllow`, `isNoneBaseStatementAllow`, `isObjectCheck`, `isSchemaCheck`, `isSelectHavingAlwayTrueCheck`, `isSelectIntoAllow`, `isSelectIntoOutfileAllow`, `isSelectUnionCheck`, `isSelectWhereAlwayTrueCheck`, `isSelelctAllow`, `isTableCheck`, `isTruncateAllow`, `isUpdateAllow`, `isUpdateWhereAlayTrueCheck`, `isVariantCheck`, `loadConfig`, `setCommentAllow`, `setDeleteAllow`, `setDeleteWhereAlwayTrueCheck`, `setDir`, `setFunctionCheck`, `setInsertAllow`, and 16 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. 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.
IC1 · Incompleteness & stubs· Empty method body · ×2
Empty method body core/src/main/java/com/alibaba/druid/support/metrics/MetricCollector.java:19— `collect` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body core/src/main/java/com/alibaba/druid/support/monitor/MonitorClient.java:170— `stop` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Disabled test core/src/test/java/com/alibaba/druid/bvt/sql/bigquery/BigQueryDirTest.java:19— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
Disabled test core/src/test/java/com/alibaba/druid/oceanbase/OceanBaseOracleXATest.java:21— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
Interpolated log message defeats structured logging druid-admin/src/main/java/com/alibaba/druid/admin/service/K8sDiscoveryClient.java:54— `info` at line 54 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.info("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 druid-admin/src/main/java/com/alibaba/druid/admin/service/MonitorStatService.java:393— `info` at line 393 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.info("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.
Silent fallback default on parse failure core/src/main/java/com/alibaba/druid/sql/visitor/functions/ToDate.java:47— `eval` returns `false` when `ParseException` 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.
Silent fallback default on parse failure core/src/main/java/com/alibaba/druid/sql/visitor/SQLEvalVisitorUtils.java:1468— `castToNumber` returns `0` 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 4 significant file(s) lose their only recent owner: core/src/main/java/com/alibaba/druid/stat/JdbcSqlStat.java, core/src/main/java/com/alibaba/druid/filter/logging/LogFilter.java, core/src/main/java/com/alibaba/druid/filter/logging/CommonsLogFilter.java, core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLAlterTableAlterColumn.java. Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 3 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 (8 single-owned of 500 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; 500 of the 1758 production source files in this repository met that bar). They are anonymized user #2 (2 file(s)), anonymized user #3 (1 file(s)), anonymized user #4 (1 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: REDACTED, core/src/main/java/com/alibaba/druid/filter/FilterManager.java, core/src/main/java/com/alibaba/druid/sql/dialect/sqlserver/parser/SQLServerExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/redshift/parser/RedshiftCreateTableParser.java.
No ADRs found druid-demo-petclinic/build.gradle:2— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `druid-demo-petclinic/build.gradle` makes this repository a deployable product (line 2).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 1 of 6 project(s) overshoot their size bounds, lowering Project Cohesion to 6.7/10. The most over is `core` (268340 LoC, 1876 module-visible types across 199 directories). 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.
D27 · Navigability· High interface indirection · ×1
High interface indirection — 38 % of calls go through an interface — tracing a call means resolving the implementation each hop. Prefer concrete types where there's a single implementation.
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 90 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: core/src/main/java/com/alibaba/druid/pool/ha/HighAvailableDataSource.java, core/src/main/java/com/alibaba/druid/util/ConcurrentLruCache.java, core/src/main/java/com/alibaba/druid/sql/dialect/gaussdb/visitor/GaussDbOutputVisitor.java, core/src/main/java/com/alibaba/druid/stat/DruidStatService.java, core/src/main/java/com/alibaba/druid/sql/dialect/oscar/parser/OscarExprParser.java, core/src/main/java/com/alibaba/druid/sql/dialect/h2/visitor/H2OutputVisitor.java, core/src/main/java/com/alibaba/druid/pool/ha/selector/RandomDataSourceValidateThread.java, core/src/main/java/com/alibaba/druid/pool/ha/node/ZookeeperNodeListener.java (and 82 more) (94 orphaned of 720 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; 720 of the 1758 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
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.
Logging is not universal — Only 6/7 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `druid-demo-petclinic`.
No SAST REDACTED:10— 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 2 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.
P4 · Deployment & Rollback· No rollback/health safety · ×1
No rollback/health safety — Deployment is orchestrated by compose, but no service declares a `healthcheck:` and nothing pins a previous image to fall back to — the runtime can tell that the container is up, not that it is serving, so a bad release is harder to detect and reverse.
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.)
Benchmarks don't track allocations core/src/test/java/com/alibaba/druid/bvt/pool/UsingDefaultLockModeBenchmarkTest.java— A JMH/Jetpack Benchmark suite exists but nothing turns on its allocation measurement — allocations (the main way hot code pressures a garbage collector or allocator) aren't being measured.
X5 · Nullable reference types· Java packages are not null-marked everywhere · ×1
Java packages are not null-marked everywhere — 0/217 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`.
Skipped (documented): dirTest core/src/test/java/com/alibaba/druid/bvt/sql/bigquery/BigQueryDirTest.java:21— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Disabled
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.
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.
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.
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.
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.
Run 01a1d52b-7a25-7752-aa23-6380c6eb4996 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 132 · Warnings: 4260 · Recommendations: 203 · Info: 108 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 13-11-2026 @ 13:49 UTC.
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.