View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="ClassDataAbstractionCoupling">
5         <property name="excludeClassesRegexps" value=".*Reader$"/>
6       </module>
7     </module>
8   </module>
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.metrics.classdataabstractioncoupling.ignore;
12  
13  import java.io.ByteArrayInputStream;
14  import java.io.CharArrayWriter;
15  import java.io.File;
16  import java.io.StringWriter;
17  import java.math.BigDecimal;
18  import java.math.BigInteger;
19  import java.math.MathContext;
20  import java.util.HashMap;
21  import java.util.HashSet;
22  import java.util.Map;
23  import java.util.Set;
24  import java.util.concurrent.atomic.AtomicInteger;
25  
26  // xdoc section -- start
27  // violation below, "Class Data Abstraction Coupling is 8 (max allowed is 7)."
28  public class Example8 {
29    Set set = new HashSet(); // Ignored by default
30    Map map = new HashMap(); // Ignored by default
31  
32    AtomicInteger atomicInteger = new AtomicInteger(); // Counted 1
33    BigInteger bigInteger = new BigInteger("0");
34    BigDecimal bigDecimal = new BigDecimal("0");
35    MathContext mathContext = new MathContext(0);
36    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(new byte[1]);
37    CharArrayWriter charArrayWriter = new CharArrayWriter();
38    StringWriter stringWriter = new StringWriter();
39    File file = new File("path"); // Counted 8
40  }
41  // xdoc section -- end