简体   繁体   中英

Remove if statement and curly braces but keep contents

I have a logger class with an isDebugEnabled() method. This is duplicated over 16,000 times so we now check if it is enabled in the method itself as opposed to everywhere in the project.

        if ( logger.isDebugEnabled() ) 
    {
        logger.logMethodEntryMessage();
    }

I want to remove the if statement but keep the logger.logMethodEntryMessage(); everywhere in the project. Is it possible to use Notepad++ and regex or eclipse and regex to accomplish this?

Thanks for your help

I believe a simple search and replace should work, Ctrl+R in Intellij or Ctrl+F in Eclipse. Here's a similar question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM