In the process of removing PMD warnings from our main product at work I was trying to automate some parts of this process by using sed (Stream EDitor), a command line program common on all Unices (such as OS X and Linux). I had already been using a regex in Vim to do remove final modifiers from methods on a file by file basis, but thought it might be quicker to do this using «find» and «sed» in stead. Boy was I wrong 🙂 But mainly just because of the different regex dialect of sed that took me a long time to figure out.
The problem was mainly due to trying to match square brackets, such as in «final public int myMethod(int args)». Les resten av dette innlegget »