Skip to content

Commit 22f4144

Browse files
mining: Update state + known rules + hints 2026-04-17 (#1043)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 482e9bc commit 22f4144

5 files changed

Lines changed: 131 additions & 9 deletions

File tree

.github/refactoring-mining/state.json

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,9 +1201,9 @@
12011201
"exhaustedCategories": []
12021202
},
12031203
"https://github.com/eclipse-jdt/eclipse.jdt.ui": {
1204-
"lastProcessedCommit": "4fd3295829fa50b7537d22c6312e61c62a66612b",
1205-
"lastProcessedDate": "2026-04-16T03:29:24.605227403Z",
1206-
"totalProcessed": 280,
1204+
"lastProcessedCommit": "e98abb86880971fbc8b5e5129445a039c7d27bce",
1205+
"lastProcessedDate": "2026-04-17T03:29:11.178823106Z",
1206+
"totalProcessed": 372,
12071207
"status": "CATCHING_UP",
12081208
"deferredCommits": [
12091209
{
@@ -1277,6 +1277,24 @@
12771277
"deferredAt": "2026-04-15T03:11:31.633184332Z",
12781278
"retryCount": 0,
12791279
"maxRetries": 3
1280+
},
1281+
{
1282+
"hash": "dff18abbf1362302a3af9e898d010c1a1e4c9a5c",
1283+
"message": "Bug 562600 - [15] Support setting compliance to 15 in Compiler\nCompliance Page\n\nChange-Id: I3dca11be68f9f8d55248f9c4262e",
1284+
"diffLines": 23,
1285+
"reason": "INCOMPLETE_BATCH",
1286+
"deferredAt": "2026-04-17T03:13:00.633985055Z",
1287+
"retryCount": 0,
1288+
"maxRetries": 3
1289+
},
1290+
{
1291+
"hash": "51b774924c2b6f140a1d37741c7805a2a32d0230",
1292+
"message": "Bug 560576: [14] There should be an easy way to enable preview features\n\n\nChange-Id: I1d50b153d91d22b599c5398c93f5dc5115",
1293+
"diffLines": 200,
1294+
"reason": "INCOMPLETE_BATCH",
1295+
"deferredAt": "2026-04-17T03:13:00.634615446Z",
1296+
"retryCount": 0,
1297+
"maxRetries": 3
12801298
}
12811299
],
12821300
"permanentlySkipped": [],
@@ -1286,17 +1304,17 @@
12861304
"completedEpochs": [],
12871305
"categoryHitCounts": {
12881306
"Eclipse Specific": 1,
1289-
"JDT Internal Refactoring": 13,
1307+
"JDT Internal Refactoring": 16,
12901308
"Code Simplification": 1,
12911309
"Performance": 6,
1292-
"JDT Internal Bug Fix": 8,
1293-
"Clean-up Bug Fix": 4,
1310+
"JDT Internal Bug Fix": 10,
1311+
"Clean-up Bug Fix": 7,
12941312
"Try-with-Resources": 2,
12951313
"JDT UI Feature Implementation": 1,
12961314
"Resource Management": 1,
12971315
"JFace API Modernization": 1,
12981316
"String-API": 1,
1299-
"Java-Modernization": 5,
1317+
"Java-Modernization": 6,
13001318
"Performance Optimization": 1,
13011319
"JDT Internal API Evolution": 1,
13021320
"Collection Performance": 1,
@@ -1323,7 +1341,14 @@
13231341
"Eclipse UI Refactoring": 1,
13241342
"Control Flow Modernization": 3,
13251343
"JDT Internal Quick Fix Implementation": 1,
1326-
"Unnecessary Annotation Removal": 1
1344+
"Unnecessary Annotation Removal": 1,
1345+
"Eclipse JDT Internal Refactoring": 3,
1346+
"Code Style / Redundancy": 1,
1347+
"Performance Optimization / JDT Internal Refactoring": 1,
1348+
"Internal Bug Fix (Eclipse-specific)": 5,
1349+
"Clean-up Enhancement (Internal JDT)": 1,
1350+
"Eclipse Platform UI": 1,
1351+
"Arrays": 1
13271352
},
13281353
"exhaustedCategories": []
13291354
},
@@ -1364,5 +1389,5 @@
13641389
"exhaustedCategories": []
13651390
}
13661391
},
1367-
"globalTotalProcessed": 22915
1392+
"globalTotalProcessed": 23007
13681393
}

docs/mining-report/known-rules.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,72 @@
18701870
"sourceCommit": "d7517a6bb8d1535b11e3fcfffef709bba94ac01a",
18711871
"status": "DISCOVERED",
18721872
"hintFile": "collection-toarray.sandbox-hint"
1873+
},
1874+
{
1875+
"id": "eclipse-jdt-internal-refactoring-this-commit-removes-the-substring-matchi",
1876+
"category": "Eclipse JDT Internal Refactoring",
1877+
"dslRule": "@id: jdt.internal.codeassist.substringmatch.preference.to.flag\n@severity: info\norg.eclipse.jdt.core.JavaCore.ENABLED.equals(org.eclipse.jdt.core.JavaCore.getOption(org.eclipse.jdt.core.JavaCore.CODEASSIST_SUBSTRING_MATCH))\n\u003d\u003e org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin.CODEASSIST_SUBSTRING_MATCH_ENABLED\n;;",
1878+
"summary": "This commit removes the \u0027substring matching\u0027 preference from the JDT UI and replaces its usage in internal code with a direct access to a new static boolean flag (`JavaManipulationPlugin.CODEASSIST_SUBSTRING_MATCH_ENABLED`). This is a direct 1:1 expression replacement, simplifying internal preference lookup logic, and is fully implementable as a GREEN TriggerPattern DSL rule for internal JDT refactoring.",
1879+
"discoveredAt": "2026-04-17",
1880+
"discoveredInRun": 23007,
1881+
"sourceCommit": "49a6149e1b7e91b77c3c12271afa0b66537a56bb",
1882+
"status": "DISCOVERED",
1883+
"hintFile": "jdt-internal-refactoring.sandbox-hint"
1884+
},
1885+
{
1886+
"id": "eclipse-jdt-internal-refactoring-this-commit-updates-internal-eclipse-jdt",
1887+
"category": "Eclipse JDT Internal Refactoring",
1888+
"dslRule": "@id: jdt.internal.textblock.previewcheck.to.java15orhigher\n@severity: info\norg.eclipse.jdt.internal.ui.text.correction.PreviewFeaturesSubProcessor.isPreviewFeatureEnabled($javaProject) :: sourceVersionGE(15)\n\u003d\u003e org.eclipse.jdt.internal.corext.util.JavaModelUtil.is15OrHigher($javaProject)\n;;",
1889+
"summary": "This commit updates internal Eclipse JDT UI code to reflect the standardization of Text Blocks in Java 15. It replaces calls to `PreviewFeaturesSubProcessor.isPreviewFeatureEnabled()` with `JavaModelUtil.is15OrHigher()`. This is a direct 1:1 method call replacement, modernizing how JDT internally checks for Java 15 capabilities. This is fully implementable as a GREEN TriggerPattern DSL rule for internal JDT refactoring, guarded by `sourceVersionGE(15)`.",
1890+
"discoveredAt": "2026-04-17",
1891+
"discoveredInRun": 23007,
1892+
"sourceCommit": "a69901540927c29e0241a6ca9e1fb86c0b015e55",
1893+
"status": "DISCOVERED",
1894+
"hintFile": "jdt-internal-refactoring.sandbox-hint"
1895+
},
1896+
{
1897+
"id": "java-modernization-this-commit-fixes-bug-563209-by-providin",
1898+
"category": "Java-Modernization",
1899+
"dslRule": "return $expr; :: sourceVersionGE(14)\n\u003d\u003e yield $expr;\n;;",
1900+
"summary": "This commit fixes Bug 563209 by providing a quick fix to replace `return` statements with `yield` statements inside switch expressions. This is a direct 1:1 statement replacement, where `return $expr;` becomes `yield $expr;`. This transformation is a core modernization for Java 14+ Switch Expressions, improving code conciseness and aligning with modern Java idioms. The TriggerPattern DSL can directly express this pattern as a statement-level replacement, guarded by `sourceVersionGE(14)` to ensure compatibility with Java 14 and later. The proposed rule would automate this change, effectively replacing parts of the imperative Java quick-fix logic.",
1901+
"discoveredAt": "2026-04-17",
1902+
"discoveredInRun": 23007,
1903+
"sourceCommit": "c0612f4ff2216edc785485f9eaf138e13f279c3a",
1904+
"status": "DISCOVERED",
1905+
"hintFile": "modernize-java14.sandbox-hint"
1906+
},
1907+
{
1908+
"id": "jdt-internal-bug-fix-this-commit-fixes-bug-563285-a-classcast",
1909+
"category": "JDT Internal Bug Fix",
1910+
"dslRule": "(org.eclipse.jdt.core.dom.TypeDeclaration) $expr\n:: inClass(\"org.eclipse.jdt.internal.ui.text.correction.proposals.InitializeFinalFieldProposal\")\n\u003d\u003e (org.eclipse.jdt.core.dom.AbstractTypeDeclaration) $expr\n;;",
1911+
"summary": "This commit fixes Bug 563285, a ClassCastException in `InitializeFinalFieldProposal`, by widening a cast from `(TypeDeclaration)` to `(AbstractTypeDeclaration)`. This change allows the internal code to correctly handle `EnumDeclaration`s, which are `AbstractTypeDeclaration`s but not `TypeDeclaration`s. This is a direct 1:1 expression replacement of a cast. The TriggerPattern DSL can implement this as a GREEN rule by matching the specific cast pattern and replacing the target type, using an `inClass` guard to ensure it applies only within the problematic internal JDT class. The DSL also implicitly handles import management for `AbstractTypeDeclaration`.",
1912+
"discoveredAt": "2026-04-17",
1913+
"discoveredInRun": 23007,
1914+
"sourceCommit": "359efe357dd13123570f8cccc80bd94425e65350",
1915+
"status": "DISCOVERED",
1916+
"hintFile": "jdt-internal-refactoring.sandbox-hint"
1917+
},
1918+
{
1919+
"id": "arrays-this-commit-replaces-java-util-objects-e",
1920+
"category": "Arrays",
1921+
"dslRule": "@id: arrays.compare.object-equals-to-arrays-equals\n@severity: warning\njava.util.Objects.equals($array1, $array2)\n:: instanceof($array1, \"java.lang.Object[]\") \u0026\u0026 instanceof($array2, \"java.lang.Object[]\")\n\u003d\u003e java.util.Arrays.equals($array1, $array2)\n;;",
1922+
"summary": "This commit replaces `java.util.Objects.equals()` with `java.util.Arrays.equals()` when comparing two array-type expressions within `VarCleanUp.java`. Using `Objects.equals()` for arrays only performs reference equality, which is almost always a bug when comparing array contents. `Arrays.equals()` performs element-wise comparison, which is the semantically correct approach. This is a highly reusable pattern for fixing a common correctness bug and improving code clarity. The transformation is a direct 1:1 expression replacement, with `instanceof` guards ensuring that both arguments are indeed array types. `Arrays.equals()` has existed since Java 1.5 and `Objects.equals()` since Java 7, so for a Java 8 baseline, no `sourceVersionGE` guard is needed in the rule itself. This pattern is fully expressible in the TriggerPattern DSL and is classified as GREEN, suitable for the `arrays.sandbox-hint` file.",
1923+
"discoveredAt": "2026-04-17",
1924+
"discoveredInRun": 23007,
1925+
"sourceCommit": "8eaa054da54392f99b36205f9daf880717fcebd2",
1926+
"status": "DISCOVERED",
1927+
"hintFile": "arrays.sandbox-hint"
1928+
},
1929+
{
1930+
"id": "internal-bug-fix-(eclipse-specific)-this-commit-fixes-a-ui-layout-bug-in-jdt",
1931+
"category": "Internal Bug Fix (Eclipse-specific)",
1932+
"dslRule": "Util.isMac() ? -4 : org.eclipse.jdt.internal.ui.preferences.Util.isLinux() ? -2 : 3\n\u003d\u003e Util.isMac() ? -4 : org.eclipse.jdt.internal.ui.preferences.Util.isLinux() ? 4 : 3\n;;",
1933+
"summary": "This commit fixes a UI layout bug in JDT\u0027s `OptionsConfigurationBlock` by changing a literal integer value (`-2` to `4`) within a ternary expression. This is a direct 1:1 replacement of a literal value within an expression, which is fully supported and can be automated as a GREEN TriggerPattern DSL rule. The rule is specific to an internal Eclipse UI class and therefore has low reusability outside of Eclipse development.",
1934+
"discoveredAt": "2026-04-17",
1935+
"discoveredInRun": 23007,
1936+
"sourceCommit": "a44e938cd859cc96c3b080651659d1de5a88b9e8",
1937+
"status": "DISCOVERED",
1938+
"hintFile": "jdt-internal-refactoring.sandbox-hint"
18731939
}
18741940
]
18751941
}

sandbox_common_core/src/main/resources/org/sandbox/jdt/triggerpattern/internal/arrays.sandbox-hint

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ $arr.clone()
2626
"Consider using Arrays.copyOf() instead of System.arraycopy() for full-array copies":
2727
System.arraycopy($src, 0, $dst, 0, $src.length)
2828
;;
29+
30+
@id: arrays.compare.object-equals-to-arrays-equals
31+
@severity: warning
32+
java.util.Objects.equals($array1, $array2)
33+
:: instanceof($array1, "java.lang.Object[]") && instanceof($array2, "java.lang.Object[]")
34+
=> java.util.Arrays.equals($array1, $array2)
35+
;;

sandbox_common_core/src/main/resources/org/sandbox/jdt/triggerpattern/internal/jdt-internal-refactoring.sandbox-hint

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,4 +923,25 @@ org.eclipse.jdt.internal.corext.util.Checks.validateModifiesFiles($files, $conte
923923
@severity: info
924924
fComplierReleaseCheck
925925
=> fCompilerReleaseCheck
926+
;;
927+
928+
@id: jdt.internal.codeassist.substringmatch.preference.to.flag
929+
@severity: info
930+
org.eclipse.jdt.core.JavaCore.ENABLED.equals(org.eclipse.jdt.core.JavaCore.getOption(org.eclipse.jdt.core.JavaCore.CODEASSIST_SUBSTRING_MATCH))
931+
=> org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin.CODEASSIST_SUBSTRING_MATCH_ENABLED
932+
;;
933+
934+
@id: jdt.internal.textblock.previewcheck.to.java15orhigher
935+
@severity: info
936+
org.eclipse.jdt.internal.ui.text.correction.PreviewFeaturesSubProcessor.isPreviewFeatureEnabled($javaProject) :: sourceVersionGE(15)
937+
=> org.eclipse.jdt.internal.corext.util.JavaModelUtil.is15OrHigher($javaProject)
938+
;;
939+
940+
(org.eclipse.jdt.core.dom.TypeDeclaration) $expr
941+
:: inClass("org.eclipse.jdt.internal.ui.text.correction.proposals.InitializeFinalFieldProposal")
942+
=> (org.eclipse.jdt.core.dom.AbstractTypeDeclaration) $expr
943+
;;
944+
945+
Util.isMac() ? -4 : org.eclipse.jdt.internal.ui.preferences.Util.isLinux() ? -2 : 3
946+
=> Util.isMac() ? -4 : org.eclipse.jdt.internal.ui.preferences.Util.isLinux() ? 4 : 3
926947
;;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
return $expr; :: sourceVersionGE(14)
2+
=> yield $expr;
3+
;;

0 commit comments

Comments
 (0)