View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3   // Copyright (C) 2001-2024 the original author or authors.
4   //
5   // This library is free software; you can redistribute it and/or
6   // modify it under the terms of the GNU Lesser General Public
7   // License as published by the Free Software Foundation; either
8   // version 2.1 of the License, or (at your option) any later version.
9   //
10  // This library is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  // Lesser General Public License for more details.
14  //
15  // You should have received a copy of the GNU Lesser General Public
16  // License along with this library; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ///////////////////////////////////////////////////////////////////////////////////////////////
19  
20  package com.puppycrawl.tools.checkstyle;
21  
22  import java.lang.annotation.ElementType;
23  import java.lang.annotation.Inherited;
24  import java.lang.annotation.Retention;
25  import java.lang.annotation.RetentionPolicy;
26  import java.lang.annotation.Target;
27  
28  /**
29   * This annotation means that the check contains file-related context and therefore
30   * cannot be used from the others threads at the same time.
31   * This annotation should be used when the check holds a thread-unsafe state.
32   * Checker guarantees that the whole file processed inside the same thread.
33   * Checker guarantees that the whole file processed with the same check instance.
34   * Checker guarantees that each check instance processes only one file at the same time.
35   * Checker guarantees that all check instances have equal (but not the same) configuration.
36   * It means, that if a check holds a property of type "array of strings",
37   * the property value will not be shared across check instances.
38   * Instead, each check instance will hold its own array instance.
39   * Checker does not guarantee that each file will have its own thread -
40   * there might be a list of files, which will be executed on the same thread.
41   * Checker does not guarantee that each file will have its own check instance -
42   * there might be a list of files, which will be checked by the same instance.
43   * Note: Checks with such annotation will be executed in mode how all Checks worked
44   * before MT mode is introduced.
45   *
46   * @noinspection ClassIndependentOfModule
47   * @noinspectionreason ClassIndependentOfModule - we keep this annotation at top level by design
48   */
49  @Retention(RetentionPolicy.RUNTIME)
50  @Target(ElementType.TYPE)
51  @Inherited
52  public @interface FileStatefulCheck {
53  
54      // this annotation does not have properties
55  
56  }