File tree Expand file tree Collapse file tree 5 files changed +48
-39
lines changed
java/com/puppycrawl/tools/checkstyle/checks/coding
resources/com/puppycrawl/tools/checkstyle/checks/coding/avoidnoargumentsuperconstructorcall Expand file tree Collapse file tree 5 files changed +48
-39
lines changed Original file line number Diff line number Diff line change 1919
2020package com .puppycrawl .tools .checkstyle .checks .coding ;
2121
22- import org .junit .jupiter .api .Disabled ;
22+ import static com .puppycrawl .tools .checkstyle .checks .coding .AvoidNoArgumentSuperConstructorCallCheck .MSG_CTOR ;
23+
2324import org .junit .jupiter .api .Test ;
2425
2526import com .puppycrawl .tools .checkstyle .AbstractExamplesModuleTestSupport ;
2627
27- @ Disabled ("until https://github.com/checkstyle/checkstyle/issues/13345" )
2828public class AvoidNoArgumentSuperConstructorCallCheckExamplesTest
2929 extends AbstractExamplesModuleTestSupport {
3030 @ Override
@@ -35,9 +35,9 @@ protected String getPackageLocation() {
3535 @ Test
3636 public void testExample1 () throws Exception {
3737 final String [] expected = {
38-
38+ "17:5: " + getCheckMessage ( MSG_CTOR ),
3939 };
4040
41- verifyWithInlineConfigParser (getPath ("Example1.txt " ), expected );
41+ verifyWithInlineConfigParser (getPath ("Example1.java " ), expected );
4242 }
4343}
Original file line number Diff line number Diff line change 1+ /*xml
2+ <module name="Checker">
3+ <module name="TreeWalker">
4+ <module name="AvoidNoArgumentSuperConstructorCall"/>
5+ </module>
6+ </module>
7+ */
8+ package com .puppycrawl .tools .checkstyle .checks .coding .avoidnoargumentsuperconstructorcall ;
9+
10+ // xdoc section -- start
11+ class SuperClass {
12+ public SuperClass () {}
13+ public SuperClass (int arg ) {}
14+ }
15+ class Example1 extends SuperClass {
16+ Example1 () {
17+ super (); // violation
18+ }
19+
20+ Example1 (int arg ) {
21+ super (arg ); // ok, explicit constructor invocation with argument
22+ }
23+
24+ Example1 (long arg ) {
25+ // ok, no explicit constructor invocation
26+ }
27+ }
28+ // xdoc section -- end
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3333 Example of violations
3434 </p >
3535 <source >
36- class MyClass extends SomeOtherClass {
37- MyClass() {
38- super(); // violation
39- }
36+ class SuperClass {
37+ public SuperClass() {}
38+ public SuperClass(int arg) {}
39+ }
40+ class Example1 extends SuperClass {
41+ Example1() {
42+ super(); // violation
43+ }
4044
41- MyClass (int arg) {
42- super(arg); // OK, call with argument have to be explicit
43- }
45+ Example1 (int arg) {
46+ super(arg); // ok, explicit constructor invocation with argument
47+ }
4448
45- MyClass (long arg) {
46- // OK, call is implicit
47- }
49+ Example1 (long arg) {
50+ // ok, no explicit constructor invocation
51+ }
4852}
4953 </source >
5054 </subsection >
Original file line number Diff line number Diff line change 2424 </p >
2525 <macro name =" example" >
2626 <param name =" path"
27- value =" resources/com/puppycrawl/tools/checkstyle/checks/coding/avoidnoargumentsuperconstructorcall/Example1.txt " />
27+ value =" resources/com/puppycrawl/tools/checkstyle/checks/coding/avoidnoargumentsuperconstructorcall/Example1.java " />
2828 <param name =" type" value =" config" />
2929 </macro >
3030 <p id =" Example1-code" >
3131 Example of violations
3232 </p >
3333 <macro name =" example" >
3434 <param name =" path"
35- value =" resources/com/puppycrawl/tools/checkstyle/checks/coding/avoidnoargumentsuperconstructorcall/Example1.txt " />
35+ value =" resources/com/puppycrawl/tools/checkstyle/checks/coding/avoidnoargumentsuperconstructorcall/Example1.java " />
3636 <param name =" type" value =" code" />
3737 </macro >
3838 </subsection >
You can’t perform that action at this time.
0 commit comments