java-refactoring-remove-parameter

Remove unused parameters from Java method signatures and update call sites.

Updated Dec 13, 2023
One-click install
npx skills add https://github.com/ranma2913/echo-api --skill java-refactoring-remove-parameter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: java-refactoring-remove-parameter
Source: https://github.com/ranma2913/echo-api/tree/main/.github/skills/java-refactoring-remove-parameter
Command: npx skills add https://github.com/ranma2913/echo-api --skill java-refactoring-remove-parameter

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Removing unused or redundant parameters from Java methods reduces API surface, simplifies signatures, and improves readability and maintainability.

Core Features & Use Cases

  • Remove unused parameters from Java method signatures while preserving behavior.
  • Update all internal and external call sites to match new signatures.
  • Validate compilation and unit tests to ensure safety after refactoring.
  • Use in large codebases and libraries to simplify public APIs and internal helpers.

Quick Start

Identify a Java method where a parameter is unused or can be derived from the object's state, then refactor by removing the parameter and updating all call sites.

Frequently Asked Questions about java-refactoring-remove-parameter

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove unused parameters from Java method signatures?

Remove unused parameters from Java methods by deleting the parameter from the signature and updating all internal and external call sites to preserve behavior. This refactoring simplifies APIs and ensures the codebase remains compilable.

What is the best way to simplify Java APIs with redundant method arguments?

Simplifying Java APIs involves removing method parameters that are never read or can be derived from object state. This reduces API surface and improves readability while validating compilation and unit tests for safety.

Can I refactor method parameters in large Java codebases and libraries?

Yes, you can refactor method parameters in large Java backend services and libraries. The process updates all call sites to match new signatures and produces compilable code compatible with Java 17.

How do I update call sites when removing a parameter in Java?

Update all call sites by removing the argument from every internal and external invocation matching the refactored method signature. This ensures behavior is preserved and the Java project remains fully compilable.

When should I not remove a parameter from a Java method?

You should not remove a parameter if it is read during method execution, serves a public API contract, or cannot be derived from object state. Removing used parameters alters behavior and breaks compilation.