InputHasFinalizer.java :  » Code-Analyzer » checkstyle-5.1 » com » puppycrawl » tools » checkstyle » coding » Java Open Source

Java Open Source » Code Analyzer » checkstyle 5.1 
checkstyle 5.1 » com » puppycrawl » tools » checkstyle » coding » InputHasFinalizer.java
package com.puppycrawl.tools.checkstyle.coding;

public class InputHasFinalizer
{
    public void finalize()
    {
        // It's not enough to check if the METHOD_DEF branch contains a PARAMETER_DEF, as that would
        // treat this method as having a parameter.
        Runnable runnable = new Runnable() {
        
            public void run() {
                reallyFinalize("hi");
            }

            // generates a PARAMETER_DEF AST inside the METHOD_DEF of finalize()
            private void reallyFinalize(String s)
            {
            }
        };
        runnable.run();
    }
    
    // should not be reported by NoFinalizer check
    public void finalize(String x)
    {
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.