Skip to content

Commit b19e05c

Browse files
author
Vincent Potucek
committed
S1144: Unused "private" methods should be removed
1 parent 9daa766 commit b19e05c

File tree

9 files changed

+5
-193
lines changed

9 files changed

+5
-193
lines changed

.github/workflows/owasp.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/rewrite.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1414
- Use S3CrtClient for higher throughput while uploading files to S3 ([#18800](https://github.com/opensearch-project/OpenSearch/pull/18800))
1515
- Add a dynamic setting to change skip_cache_factor and min_frequency for querycache ([#18351](https://github.com/opensearch-project/OpenSearch/issues/18351))
1616
- Add overload constructor for Translog to accept Channel Factory as a parameter ([#18918](https://github.com/opensearch-project/OpenSearch/pull/18918))
17-
- Introduce `Rewrite` fixing `S1144`: Unused "private" methods should be removed ([#18791](https://github.com/opensearch-project/OpenSearch/pull/18791))
1817

1918
### Changed
2019
- Add CompletionStage variants to methods in the Client Interface and default to ActionListener impl ([#18998](https://github.com/opensearch-project/OpenSearch/pull/18998))
@@ -34,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3433
- Grant access to testclusters dir for tests ([#19085](https://github.com/opensearch-project/OpenSearch/issues/19085))
3534
- Fix assertion error when collapsing search results with concurrent segment search enabled ([#19053](https://github.com/opensearch-project/OpenSearch/pull/19053))
3635
- Fix skip_unavailable setting changing to default during node drop issue ([#18766](https://github.com/opensearch-project/OpenSearch/pull/18766))
36+
- S1144: Unused "private" methods should be removed ([#18918](https://github.com/opensearch-project/OpenSearch/pull/18918))
3737

3838
### Dependencies
3939
- Bump `com.netflix.nebula.ospackage-base` from 12.0.0 to 12.1.0 ([#19019](https://github.com/opensearch-project/OpenSearch/pull/19019))

DEVELOPER_GUIDE.md

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ Fork [opensearch-project/OpenSearch](https://github.com/opensearch-project/OpenS
7676

7777
#### JDK
7878

79-
OpenSearch recommends building with the [Temurin/Adoptium](https://adoptium.net/temurin/releases/) distribution. JDK 11 is the minimum supported, and JDK-24 is the newest supported. You must have a supported JDK installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-21`.
79+
OpenSearch recommends building with the [Temurin/Adoptium](https://adoptium.net/temurin/releases/) distribution. JDK 11 is the minimum supported, and JDK-24 is the newest supported. You must have a supported JDK installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-21`.
8080

81-
Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).
81+
Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).
8282

8383

8484
In addition, certain backward compatibility tests check out and compile the previous major version of OpenSearch, and therefore require installing [JDK 11](https://adoptium.net/temurin/releases/?version=11) and [JDK 17](https://adoptium.net/temurin/releases/?version=17) and setting the `JAVA11_HOME` and `JAVA17_HOME` environment variables. More to that, since 8.10 release, Gradle has deprecated the usage of the any JDKs below JDK-16. For smooth development experience, the recommendation is to install at least [JDK 17](https://adoptium.net/temurin/releases/?version=17) or [JDK 21](https://adoptium.net/temurin/releases/?version=21). If you still want to build with JDK-11 only, please add `-Dorg.gradle.warning.mode=none` when invoking any Gradle build task from command line, for example:
@@ -341,49 +341,6 @@ Please follow these formatting guidelines:
341341
* Note that JavaDoc and block comments i.e. `/* ... */` are not formatted, but line comments i.e `// ...` are.
342342
* There is an implicit rule that negative boolean expressions should use the form `foo == false` instead of `!foo` for better readability of the code. While this isn't strictly enforced, it might get called out in PR reviews as something to change.
343343

344-
## 🚀 Code Transformation & Automated Rewriting
345-
*(Advanced Refactoring, Modernization, and Bulk Code Changes)*
346-
347-
### 🔧 Automated Rewriting of Source Code
348-
The OpenSearch build system supports **automated, large-scale code transformations** using [Moderne](https://moderne.io/) and OpenRewrite. These tools enable:
349-
350-
- **Safe Refactoring** (e.g., renaming methods, migrating deprecated APIs)
351-
- **Modernization** (e.g., adopting Java 17 features like `var`, `records`, or `switch` expressions)
352-
- **Anti-Pattern Fixes** (e.g., replacing `Vector` with `ArrayList`, removing redundant `StringBuilder`)
353-
- **Convention Enforcement** (e.g., consistent JUnit test naming, `final` keyword usage)
354-
- **Dependency Upgrades** (e.g., automatic migration when updating library versions)
355-
356-
357-
### ⚙️ Usage
358-
359-
- **Dry-run (check for changes):**
360-
- Full project:
361-
- `./gradlew rewriteDryRun`
362-
- Subproject (e.g., `server`):
363-
- `./gradlew server: rewriteDryRun`
364-
---
365-
366-
- **Apply transformations:**
367-
- Full project:
368-
- `./gradlew rewriteRun`
369-
- Subproject:
370-
- `./gradlew server:rewriteRun`
371-
---
372-
### 🛠️ Example Transformations
373-
374-
| **Before** | **After** | **Rule** |
375-
|--------------------------------|------------------------------------|-----------------------------------|
376-
| `new ArrayList<String>()` | `new ArrayList<>()` | Diamond Operator (Java 7+) |
377-
| `if (x == false)` | `if (!x)` | Boolean Simplification |
378-
| `@Test public void testFoo()` | `@Test void foo()` | JUnit 5 Convention |
379-
380-
### ⚠️ Notes
381-
382-
- **Custom Rules**: Add project-specific rewrites in `code-convention.yml`.
383-
- **Exclusions**: Use `// rewrite:off` and `// rewrite:on` to opt out of transformations for specific code blocks.
384-
- **PR Reviews**: Automated rewrites are flagged in CI. Verify changes match intent before merging.
385-
- **javalangoutofmemoryerror**: https://docs.openrewrite.org/reference/faq#im-getting-javalangoutofmemoryerror-java-heap-space-when-running-openrewrite
386-
387344
## Adding Dependencies
388345

389346
When adding a new dependency or removing an existing dependency via any `build.gradle` (that are not in the test scope), update the dependency LICENSE and library SHAs.

build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ plugins {
5656
id 'opensearch.global-build-info'
5757
id "com.diffplug.spotless" version "6.25.0" apply false
5858
id "org.gradle.test-retry" version "1.6.2" apply false
59-
id "org.openrewrite.rewrite" version "7.15.0" apply false
60-
id "org.owasp.dependencycheck" version "12.1.3" apply false
6159
id "test-report-aggregation"
6260
id 'jacoco-report-aggregation'
6361
}
@@ -67,8 +65,6 @@ apply from: 'gradle/runtime-jdk-provision.gradle'
6765
apply from: 'gradle/ide.gradle'
6866
apply from: 'gradle/forbidden-dependencies.gradle'
6967
apply from: 'gradle/formatting.gradle'
70-
apply from: 'gradle/rewrite.gradle'
71-
apply from: 'gradle/owasp.gradle'
7268
apply from: 'gradle/local-distribution.gradle'
7369
apply from: 'gradle/run.gradle'
7470
apply from: 'gradle/missing-javadoc.gradle'

gradle.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
org.gradle.caching=true
1414
org.gradle.warning.mode=none
1515
org.gradle.parallel=true
16-
org.gradle.configuration-cache=true
17-
org.gradle.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError -Xss2m \
16+
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Xss2m \
1817
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
1918
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
2019
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
2120
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
2221
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
23-
options.forkOptions.memoryMaximumSize=8g
22+
options.forkOptions.memoryMaximumSize=3g
2423

2524
# Disable duplicate project id detection
2625
# See https://docs.gradle.org/current/userguide/upgrading_version_6.html#duplicate_project_names_may_cause_publication_to_fail

gradle/owasp.gradle

Lines changed: 0 additions & 33 deletions
This file was deleted.

gradle/rewrite.gradle

Lines changed: 0 additions & 45 deletions
This file was deleted.

rewrite.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)