[PR #458] [MERGED] Fix IntelliJ Java warnings, make classes final if possible #562

Closed
opened 2025-12-30 01:25:21 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/458
Author: @odenix
Created: 4/27/2024
Status: Merged
Merged: 5/1/2024
Merged by: @bioball

Base: mainHead: fix-warnings


📝 Commits (2)

  • 6509747 Fix IntelliJ warnings in Java code
  • 3563c28 Make Java classes final if possible

📊 Changes

103 files changed (+237 additions, -372 deletions)

View changed files

📝 bench/src/jmh/java/org/pkl/core/parser/ParserBenchmark.java (+26 -25)
📝 pkl-config-java/src/main/java/org/pkl/config/java/Config.java (+1 -1)
📝 pkl-config-java/src/main/java/org/pkl/config/java/mapper/ConverterFactory.java (+2 -2)
📝 pkl-config-java/src/main/java/org/pkl/config/java/mapper/Reflection.java (+4 -4)
📝 pkl-core/src/generator/kotlin/org/pkl/core/generator/MemberRegistryGenerator.kt (+1 -1)
📝 pkl-core/src/main/java/org/pkl/core/BufferedLogger.java (+1 -1)
📝 pkl-core/src/main/java/org/pkl/core/DurationUnit.java (+9 -18)
📝 pkl-core/src/main/java/org/pkl/core/Loggers.java (+2 -0)
📝 pkl-core/src/main/java/org/pkl/core/ModuleSource.java (+1 -1)
📝 pkl-core/src/main/java/org/pkl/core/PType.java (+1 -2)
📝 pkl-core/src/main/java/org/pkl/core/Release.java (+1 -1)
📝 pkl-core/src/main/java/org/pkl/core/RendererException.java (+1 -1)
📝 pkl-core/src/main/java/org/pkl/core/SecurityManagerException.java (+1 -1)
📝 pkl-core/src/main/java/org/pkl/core/StackFrameTransformers.java (+1 -1)
📝 pkl-core/src/main/java/org/pkl/core/ValueFormatter.java (+0 -10)
📝 pkl-core/src/main/java/org/pkl/core/ValueRenderers.java (+3 -2)
📝 pkl-core/src/main/java/org/pkl/core/Version.java (+1 -1)
📝 pkl-core/src/main/java/org/pkl/core/ast/VmModifier.java (+2 -0)
📝 pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java (+25 -38)
📝 pkl-core/src/main/java/org/pkl/core/ast/builder/ImportsAndReadsParser.java (+2 -2)

...and 80 more files

📄 Description

Fix all IntelliJ warnings in pkl-core production code except for bogus spelling warnings and warnings about unused public methods. I didn't delete any unused public method because it's hard to tell for sure which packages are public APIs.

Changes made:

  • use text block instead of string concatenation
  • extract method to avoid code duplication
  • use switch expression
  • fix Javadoc syntax and spelling
  • fix spelling in comment
  • increase class visibility to match visibility of use site
  • delete overriding method with same implementation
  • use String.isEmpty() and StringBuilder.isEmpty()
  • add @Serial annotation
  • make field final
  • remove unused field
  • remove unused private method
  • remove exceptions that aren't thrown from throws clause
  • insert non-null assertion
  • annotate overriding method with @Nonnull
  • suppress warning
  • delete unused class (WriteAuxiliarySlotNode)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/458 **Author:** [@odenix](https://github.com/odenix) **Created:** 4/27/2024 **Status:** ✅ Merged **Merged:** 5/1/2024 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `fix-warnings` --- ### 📝 Commits (2) - [`6509747`](https://github.com/apple/pkl/commit/6509747ff1d1db91138c828fb2bc5f59d79b523a) Fix IntelliJ warnings in Java code - [`3563c28`](https://github.com/apple/pkl/commit/3563c28d6a6b31c1da24951300a4add40ea37269) Make Java classes final if possible ### 📊 Changes **103 files changed** (+237 additions, -372 deletions) <details> <summary>View changed files</summary> 📝 `bench/src/jmh/java/org/pkl/core/parser/ParserBenchmark.java` (+26 -25) 📝 `pkl-config-java/src/main/java/org/pkl/config/java/Config.java` (+1 -1) 📝 `pkl-config-java/src/main/java/org/pkl/config/java/mapper/ConverterFactory.java` (+2 -2) 📝 `pkl-config-java/src/main/java/org/pkl/config/java/mapper/Reflection.java` (+4 -4) 📝 `pkl-core/src/generator/kotlin/org/pkl/core/generator/MemberRegistryGenerator.kt` (+1 -1) 📝 `pkl-core/src/main/java/org/pkl/core/BufferedLogger.java` (+1 -1) 📝 `pkl-core/src/main/java/org/pkl/core/DurationUnit.java` (+9 -18) 📝 `pkl-core/src/main/java/org/pkl/core/Loggers.java` (+2 -0) 📝 `pkl-core/src/main/java/org/pkl/core/ModuleSource.java` (+1 -1) 📝 `pkl-core/src/main/java/org/pkl/core/PType.java` (+1 -2) 📝 `pkl-core/src/main/java/org/pkl/core/Release.java` (+1 -1) 📝 `pkl-core/src/main/java/org/pkl/core/RendererException.java` (+1 -1) 📝 `pkl-core/src/main/java/org/pkl/core/SecurityManagerException.java` (+1 -1) 📝 `pkl-core/src/main/java/org/pkl/core/StackFrameTransformers.java` (+1 -1) 📝 `pkl-core/src/main/java/org/pkl/core/ValueFormatter.java` (+0 -10) 📝 `pkl-core/src/main/java/org/pkl/core/ValueRenderers.java` (+3 -2) 📝 `pkl-core/src/main/java/org/pkl/core/Version.java` (+1 -1) 📝 `pkl-core/src/main/java/org/pkl/core/ast/VmModifier.java` (+2 -0) 📝 `pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java` (+25 -38) 📝 `pkl-core/src/main/java/org/pkl/core/ast/builder/ImportsAndReadsParser.java` (+2 -2) _...and 80 more files_ </details> ### 📄 Description Fix all IntelliJ warnings in pkl-core production code except for bogus spelling warnings and warnings about unused public methods. I didn't delete any unused public method because it's hard to tell for sure which packages are public APIs. Changes made: - use text block instead of string concatenation - extract method to avoid code duplication - use switch expression - fix Javadoc syntax and spelling - fix spelling in comment - increase class visibility to match visibility of use site - delete overriding method with same implementation - use String.isEmpty() and StringBuilder.isEmpty() - add `@Serial` annotation - make field final - remove unused field - remove unused private method - remove exceptions that aren't thrown from throws clause - insert non-null assertion - annotate overriding method with `@Nonnull` - suppress warning - delete unused class (WriteAuxiliarySlotNode) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:25:21 +01:00
adam closed this issue 2025-12-30 01:25:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#562