View Javadoc
1   /*
2   FinalParameters
3   ignorePrimitiveTypes = (default)false
4   ignoreUnnamedParameters = (default)true
5   tokens = (default)METHOD_DEF, CTOR_DEF
6   
7   
8   */
9   
10  package com.puppycrawl.tools.checkstyle.checks.finalparameters;
11  
12  public class InputFinalParametersPrimitiveTypes2
13  {
14      void foo(int i) {}  // violation, 'i' should be final
15      void foo1(int i, String k, float s) {}
16      // 3 violations above:
17      //    'Parameter i should be final.'
18      //    'Parameter k should be final.'
19      //    'Parameter s should be final.'
20      void foo2(String s, Object o, long l) {}
21      // 3 violations above:
22      //    'Parameter s should be final.'
23      //    'Parameter o should be final.'
24      //    'Parameter l should be final.'
25      void foo3(int[] array) {} // violation, 'array' should be final
26      void foo4(int i, float x, int[] s) {}
27      // 3 violations above:
28      //    'Parameter i should be final.'
29      //    'Parameter x should be final.'
30      //    'Parameter s should be final.'
31      void foo5(int x, long[] l, String s) {}
32      // 3 violations above:
33      //    'Parameter x should be final.'
34      //    'Parameter l should be final.'
35      //    'Parameter s should be final.'
36  }