On Sun, 29 Mar 2026 07:39:02 GMT, Shun Ohta <[email protected]> wrote:

> # Problem:
> - Redundant ternary operator patterns such as `<cond> ? true : false` and 
> `<cond> ? false : true` exist in the codebase
> - Since the condition already evaluates to a `boolean`, the ternary operator 
> is unnecessary
> 
> # Analysis:
> - Since the original ticket was filed (JDK 10), some files have been removed 
> and some patterns have already been fixed
> - I re-evaluated the list of redundant patterns against the current codebase
> 
> ## Redundant patterns by module
> 
> - `src/` — 74 occurrences: java.xml (31), java.desktop (20), java.base (8), 
> others (15)
> - `test/` — 138 occurrences: test/hotspot (76), test/jdk (52), others (10)
> 
> # Solution:
> - Given the wide impact scope across multiple modules, the fixes are 
> partitioned by module to facilitate easier review
> - This PR addresses redundant patterns within `java.base`, the core module of 
> the JDK
> 
> ## Changes in java.base (8 files)
> 
> | No. | File | Line |
> |-----|------|:----:|
> | 1 | `share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java` 
> | 45 |
> | 2 | `share/classes/sun/security/provider/X509Factory.java` | 564 |
> | 3 | `share/classes/sun/text/DictionaryBasedBreakIterator.java` | 131 |
> | 4 | `share/classes/jdk/internal/event/SocketReadEvent.java` | 141 |
> | 5 | `share/classes/java/text/CollationElementIterator.java` | 638 |
> | 6 | `unix/classes/sun/nio/fs/UnixPath.java` | 705 |
> | 7 | `share/classes/sun/security/validator/Validator.java` | 268 |
> | 8 | `share/classes/jdk/internal/icu/lang/UCharacter.java` | 474 |
> 
> # Testing:
> This PR performs semantically equivalent cleanups with no behavioral changes. 
> I have verified that all relevant existing `jtreg` tests pass.
> 
> ## Test mapping
> 
> | No. | Changed file | Test file |
> |-----|------------|--------------|
> | 1 | `NTLMAuthenticationProxy.java` | 
> `test/jdk/sun/net/www/protocol/http/NoNTLM.java` |
> | 2 | `X509Factory.java` | 
> `test/jdk/sun/security/provider/X509Factory/BadPem.java` |
> | 3 | `DictionaryBasedBreakIterator.java` | 
> `test/jdk/java/text/BreakIterator/BreakIteratorTest.java` etc. |
> | 4 | `SocketReadEvent.java` | 
> `test/jdk/jdk/jfr/event/io/TestSocketEvents.java` etc. |
> | 5 | `CollationElementIterator.java` | 
> `test/jdk/java/text/Collator/IteratorTest.java` etc. |
> | 6 | `UnixPath.java` | `test/jdk/java/nio/file/Path/PathOps.java` etc. |
> | 7 | `Validator.java` | 
> `test/jdk/sun/security/validator/EndEntityExtensionCheck.java` etc. |
> | 8 | `UCharacter.java` | (Comment-only change; no test needed) |
> 
> #### Notes on verification
> While verifying the changes against the exis...

I acknowledge that I used an LLM to generate the descriptions and identify 
patterns, but I manually reviewed all changes.
I will close this pull request, and for future contributions, I will ensure 
that all development and documentation are done without any AI assistance.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/30486#issuecomment-4229367999

Reply via email to