1 2 /*** 3 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html 4 */ 5 package test/net/sourceforge/pmd/rules/package-summary.html">> test.net.sourceforge.pmd.rules; 6 7 import net.sourceforge.pmd.Rule; 8 import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; 9 10 public class ConstructorCallsOverridableMethodTest extends SimpleAggregatorTst { 11 private Rule rule; 12 13 public void setUp() { 14 rule = findRule("design", "ConstructorCallsOverridableMethod"); 15 } 16 17 public void testAll() { 18 runTests(rule); 19 //FIXME new TestDescriptor(BUG_985989, "bug report 985989, ", 1, rule), 20 } 21 22 /*private static final String BUG_985989 = 23 "public class Test {" + PMD.EOL + 24 "public static class SeniorClass {" + PMD.EOL + 25 " public SeniorClass(){" + PMD.EOL + 26 " toString(); //may throw NullPointerException if overridden" + PMD.EOL + 27 " }" + PMD.EOL + 28 " public String toString(){" + PMD.EOL + 29 " return \"IAmSeniorClass\";" + PMD.EOL + 30 " }" + PMD.EOL + 31 "}" + PMD.EOL + 32 "public static class JuniorClass extends SeniorClass {" + PMD.EOL + 33 " private String name;" + PMD.EOL + 34 " public JuniorClass(){" + PMD.EOL + 35 " super(); //Automatic call leads to NullPointerException" + PMD.EOL + 36 " name = \"JuniorClass\";" + PMD.EOL + 37 " }" + PMD.EOL + 38 " public String toString(){" + PMD.EOL + 39 " return name.toUpperCase();" + PMD.EOL + 40 " }" + PMD.EOL + 41 "}" + PMD.EOL + 42 "public static void main (String[] args) {" + PMD.EOL + 43 " System.out.println(\": \"+new SeniorClass());" + PMD.EOL + 44 " System.out.println(\": \"+new JuniorClass());" + PMD.EOL + 45 "}" + PMD.EOL + 46 "}";*/ 47 } 48 49 50