java-refactoring-remove-parameter

द्वारा github

जावा भाषा में पैरामीटर हटाने का उपयोग करके रीफैक्टरिंग

npx skills add https://github.com/github/awesome-copilot --skill java-refactoring-remove-parameter

Refactoring Java Methods with Remove Parameter

Role

You are an expert in refactoring Java methods.

Below are 2 examples (with titles code before and code after refactoring) that represents Remove Parameter.

Code Before Refactoring 1:

public Backend selectBackendForGroupCommit(long tableId, ConnectContext context, boolean isCloud)
        throws LoadException, DdlException {
    if (!Env.getCurrentEnv().isMaster()) {
        try {
            long backendId = new MasterOpExecutor(context)
                    .getGroupCommitLoadBeId(tableId, context.getCloudCluster(), isCloud);
            return Env.getCurrentSystemInfo().getBackend(backendId);
        } catch (Exception e) {
            throw new LoadException(e.getMessage());
        }
    } else {
        return Env.getCurrentSystemInfo()
                .getBackend(selectBackendForGroupCommitInternal(tableId, context.getCloudCluster(), isCloud));
    }
}

Code After Refactoring 1:

public Backend selectBackendForGroupCommit(long tableId, ConnectContext context)
        throws LoadException, DdlException {
    if (!Env.getCurrentEnv().isMaster()) {
        try {
            long backendId = new MasterOpExecutor(context)
                    .getGroupCommitLoadBeId(tableId, context.getCloudCluster());
            return Env.getCurrentSystemInfo().getBackend(backendId);
        } catch (Exception e) {
            throw new LoadException(e.getMessage());
        }
    } else {
        return Env.getCurrentSystemInfo()
                .getBackend(selectBackendForGroupCommitInternal(tableId, context.getCloudCluster()));
    }
}

Code Before Refactoring 2:

NodeImpl( long id, long firstRel, long firstProp )
{
     this( id, false );
}

Code After Refactoring 2:

NodeImpl( long id)
{
     this( id, false );
}

Task

Apply Remove Parameter to improve readability, testability, maintainability, reusability, modularity, cohesion, low coupling, and consistency.

Always return a complete and compilable method (Java 17).

Perform intermediate steps internally:

  • First, analyze each method and identify parameters that are unused or redundant (i.e., values that can be obtained from class fields, constants, or other method calls).
  • For each qualifying method, remove the unnecessary parameters from its definition and from all its internal calls.
  • Ensure that the method continues to function correctly after parameter removal.
  • Output only the refactored code inside a single java block.
  • Do not remove any functionality from the original method.
  • Include a one-line comment above each modified method indicating which parameter was removed and why.

Code to be Refactored:

Now, assess all methods with unused parameters and refactor them using Remove Parameter

github की और Skills

console-rendering
github
Go में struct टैग-आधारित कंसोल रेंडरिंग सिस्टम का उपयोग करने के निर्देश
official
acquire-codebase-knowledge
github
इस कौशल का उपयोग तब करें जब उपयोगकर्ता स्पष्ट रूप से किसी मौजूदा कोडबेस का मानचित्रण, दस्तावेज़ीकरण या उसमें शामिल होने का अनुरोध करे। "इस कोडबेस का मानचित्रण करें", "दस्तावेज़ीकरण करें..." जैसे संकेतों के लिए ट्रिगर करें।
official
acreadiness-assess
github
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc…
official
acreadiness-generate-instructions
github
एजेंटआरसी निर्देश कमांड के माध्यम से अनुकूलित AI एजेंट निर्देश फ़ाइलें उत्पन्न करता है। .github/copilot-instructions.md (डिफ़ॉल्ट, VS में Copilot के लिए अनुशंसित) उत्पन्न करता है…
official
acreadiness-policy
github
उपयोगकर्ता को AgentRC नीति चुनने, लिखने या लागू करने में सहायता करें। नीतियाँ अप्रासंगिक जाँचों को अक्षम करके, प्रभाव/स्तर को ओवरराइड करके, सेट करके तत्परता स्कोरिंग को अनुकूलित करती हैं…
official
add-educational-comments
github
कोड फ़ाइलों में शैक्षिक टिप्पणियाँ जोड़कर उन्हें प्रभावी शिक्षण संसाधनों में बदलें। व्याख्या की गहराई और लहज़े को तीन कॉन्फ़िगरेबल ज्ञान स्तरों के अनुसार अनुकूलित करता है: शुरुआती, मध्यवर्ती और उन्नत। यदि कोई फ़ाइल प्रदान नहीं की गई है तो स्वचालित रूप से एक फ़ाइल का अनुरोध करता है, त्वरित चयन के लिए क्रमांकित सूची मिलान के साथ। केवल शैक्षिक टिप्पणियों का उपयोग करके फ़ाइलों को 125% तक विस्तारित कर
official
adobe-illustrator-scripting
github
एक्सटेंडस्क्रिप्ट (जावास्क्रिप्ट/JSX) का उपयोग करके Adobe Illustrator ऑटोमेशन स्क्रिप्ट लिखें, डीबग करें और ऑप्टिमाइज़ करें। उन स्क्रिप्ट को बनाने या संशोधित करने के लिए उपयोग करें जो…
official
agent-governance
github
एजेंट टूल एक्सेस और व्यवहार को नियंत्रित करने के लिए घोषणात्मक नीतियां, इरादा वर्गीकरण और ऑडिट ट्रेल्स। कंपोजेबल गवर्नेंस नीतियां अनुमत/अवरुद्ध टूल, सामग्री फ़िल्टर, दर सीमाएं और अनुमोदन आवश्यकताओं को परिभाषित करती हैं — कॉन्फ़िगरेशन के रूप में संग्रहीत, कोड नहीं। सिमैंटिक इरादा वर्गीकरण टूल निष्पादन से पहले पैटर्न-आधारित संकेतों का उपयोग करके खतरनाक प्रॉम्प्ट
official