View Javadoc
1   /*
2   ClassFanOutComplexity
3   max = 0
4   excludedClasses = (default)ArrayIndexOutOfBoundsException, ArrayList, Boolean, Byte, \
5                     Character, Class, Collection, Deprecated, Deque, Double, DoubleStream, \
6                     EnumSet, Exception, Float, FunctionalInterface, HashMap, HashSet, \
7                     IllegalArgumentException, IllegalStateException, IndexOutOfBoundsException, \
8                     IntStream, Integer, LinkedHashMap, LinkedHashSet, LinkedList, List, Long, \
9                     LongStream, Map, NullPointerException, Object, Optional, OptionalDouble, \
10                    OptionalInt, OptionalLong, Override, Queue, RuntimeException, SafeVarargs, \
11                    SecurityException, Set, Short, SortedMap, SortedSet, Stream, String, \
12                    StringBuffer, StringBuilder, SuppressWarnings, Throwable, TreeMap, TreeSet, \
13                    UnsupportedOperationException, Void, boolean, byte, char, double, float, \
14                    int, long, short, var, void
15  excludeClassesRegexps =
16  excludedPackages = (default)
17  
18  
19  */
20  
21  package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity;
22  
23  import java.util.ArrayList;
24  import java.util.Collection;
25  import java.util.EnumSet;
26  import java.util.HashMap;
27  import java.util.HashSet;
28  import java.util.LinkedHashMap;
29  import java.util.LinkedHashSet;
30  import java.util.List;
31  import java.util.Map;
32  import java.util.Optional;
33  import java.util.OptionalDouble;
34  import java.util.OptionalInt;
35  import java.util.OptionalLong;
36  import java.util.Set;
37  import java.util.stream.DoubleStream;
38  import java.util.stream.IntStream;
39  import java.util.stream.LongStream;
40  import java.util.stream.Stream;
41  
42  import javax.naming.NamingException;
43  
44  public class InputClassFanOutComplexity4 { // violation
45      private class InnerClass { //singleline comment
46          public List _list = new ArrayList();
47      }
48  
49      private class AnotherInnerClass {
50          public String _string = "";
51      }
52  
53      public Set _set = /*block comment*/new HashSet();
54      public Map _map = new HashMap();
55      public String _string = "";
56      public int[] _intArray = new int[0];
57      public InnerClass _innerClass = new InnerClass();
58      public AnotherInnerClass _anotherInnerClass = new AnotherInnerClass();
59  
60      public void foo() throws NamingException {
61      }
62  
63  }
64  
65  enum InnerEnum4 {
66      VALUE1;
67  
68      private InnerEnum4()
69      {
70          map2 = new HashMap();
71      }
72      private Set map1 = new HashSet();
73      private Map map2;
74  }
75  
76  class InputThrows4 { // violation
77  
78      public void get() throws NamingException, IllegalArgumentException {
79          new java.lang.ref.ReferenceQueue<Integer>();
80      }
81  }
82  
83  class InputMultiDimensionalArray4 {
84      public  Object[][] get() {
85          return new Object[][]{};
86      }
87  }
88  
89  class InputCollectionsExt4 {
90      private Collection col;
91      private EnumSet enumSet;
92      private LinkedHashMap map;
93      private LinkedHashSet set;
94  }
95  
96  class InputOptionals4 {
97      private Optional<Long> op1;
98      private OptionalInt op2;
99      private OptionalLong op3;
100     private OptionalDouble op4;
101 }
102 
103 class InputStreams4 {
104     private Stream s1;
105     private IntStream s2;
106     private LongStream s3;
107     private DoubleStream s4;
108 }