View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="ClassDataAbstractionCoupling">
5         <property name="excludedPackages" value="java.io"/>
6       </module>
7     </module>
8   </module>
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.ignore;
12  
13  // xdoc section -- start
14  import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.Example2;
15  import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.Example3;
16  import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.ignore.deeper.Example4;
17  import com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.ignore.deeper.Example6;
18  
19  import java.io.BufferedReader;
20  import java.io.ByteArrayInputStream;
21  import java.io.CharArrayWriter;
22  import java.io.PipedReader;
23  import java.math.BigDecimal;
24  import java.math.BigInteger;
25  import java.math.MathContext;
26  import java.util.HashMap;
27  import java.util.HashSet;
28  import java.util.Map;
29  import java.util.Set;
30  import java.util.concurrent.atomic.AtomicInteger;
31  
32  // violation below, "Class Data Abstraction Coupling is 8 (max allowed is 7)."
33  class Example10 {
34    Set set = new HashSet(); // Ignored by default
35    Map map = new HashMap(); // Ignored by default
36  
37    AtomicInteger atomicInteger = new AtomicInteger(); // Counted 1
38    BigInteger bigInteger = new BigInteger("0");
39    BigDecimal bigDecimal = new BigDecimal("0");
40    MathContext mathContext = new MathContext(0);
41    Example2 example3 = new Example2();
42    Example3 example4 = new Example3();
43    Example4 example5 = new Example4();
44    Example6 example6 = new Example6(); // Counted 8
45  
46    // Ignored using module excludedPackages property
47    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(new byte[1]);
48    PipedReader pipedReader = new PipedReader();
49    BufferedReader bufferedReader = new BufferedReader(pipedReader);
50    CharArrayWriter charArrayWriter = new CharArrayWriter();
51  }
52  // xdoc section -- end