IllegalType
Since Checkstyle 3.2
On This Page
- Description
- Properties
-
- The default check
- So that particular tokens are checked
- So that it ignores function() methods
- So that it validates abstract class names
- So that it verifies only public, protected or static methods and fields
- So that it verifies usage of types Boolean and Foo
- Target fields types only
- So that it violates Abstract Types which are illegal
- Example of Usage
- Violation Messages
- Fully Qualified Name
- Parent Module
Description
Checks that particular classes or interfaces are never used.
Rationale: Helps reduce coupling on concrete classes.
For additional restriction of type usage see also: IllegalInstantiation, IllegalImport
Notes
It is possible to set illegal class names via short or canonical name. Specifying illegal type invokes analyzing imports and Check puts violations at corresponding declarations (of variables, methods or parameters). This helps to avoid ambiguous cases, e.g.: java.awt.List was set as illegal class name, then, code like:
import java.util.List;
...
List list; //No violation here
will be ok.
In most cases it's justified to put following classes to illegalClassNames:
- GregorianCalendar
- Hashtable
- ArrayList
- LinkedList
- Vector
as methods that differ from interface methods are rarely used, so in most cases user will benefit from checking for them.
Properties
| name | description | type | default value | since |
|---|






