Commit Graph

4355 Commits

Author SHA1 Message Date
Ruslan Diachenko 39e6f8e86c Issue #1566: Constructor definition in wrong order fixed 2015-08-09 07:43:29 +01:00
Ruslan Diachenko 9e90fceb77 Issue #1566: AnnonInnerLength violations fixed 2015-08-09 09:23:29 +03:00
Ruslan Diachenko 0f4494ebeb Issue #1566: 'Fields and methods should be before inner classes' violations fixed 2015-08-09 06:01:43 +01:00
Ruslan Diachenko 93914f360e Issue #1566: Line cannot start with this symbol violations fixed 2015-08-09 05:53:49 +03:00
Ruslan Diachenko 71e1707a3f Issue #1566: Line has trailing spaces violations fixed 2015-08-09 05:50:58 +03:00
Ruslan Diachenko 39085d27c1 Issue #1566: First sentence should end with a period violations fixed 2015-08-09 05:49:20 +03:00
Ruslan Diachenko 61f90aee7e Issue #1566: '(' should be on the previous line fixed 2015-08-09 05:47:48 +03:00
Ruslan Diachenko 6bb0d26301 Issue #1566: column X should be alone on a line fixed 2015-08-09 05:46:48 +03:00
Ruslan Diachenko 801db8ed46 Issue #1566: JavadocMethod @return violations fixed 2015-08-09 05:42:54 +03:00
Ruslan Diachenko 93a6487be7 Issue #1566: WhitespaceAfter, DeclarationOrder, ArrayTrailingComma, ParenPad violations fixed 2015-08-09 05:40:23 +03:00
Ruslan Diachenko b4e1e170c8 Issue #1566: '&&' should be on a new line' fixed 2015-08-09 05:38:49 +03:00
Andrei Selkin a73868f2d3 Set parameter 'failOnError' of maven javadoc plugin to true, issue #291. 2015-08-09 05:36:43 +03:00
Andrei Selkin 75ed7a6d25 Resolved javadoc problems that reported by java 8 at CommentsIndentationCheck, issue #291. 2015-08-09 05:36:43 +03:00
Baratali Izmailov 16ae5032c5 Issue #1293: Improved coverage for IllegalInstantiationCheck 2015-08-09 05:32:39 +03:00
Michal Kordas 0dbbf3b83a Suppress wrong root element in tests. #1555 2015-08-09 05:30:27 +03:00
Michal Kordas f7f377f506 Remove redundant throws declarations. #1555
Fixes `RedundantThrows` inspection violations.

Description:
>This inspection reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
2015-08-09 05:28:36 +03:00
Michal Kordas 57d522e209 Refactor anonymous classes with too many methods. #1555
Fixes `AnonymousClassMethodCount` inspection violation.

Description:
>Reports anonymous inner class with too many methods. Anonymous classes with more than a very low number of methods may be difficult to understand, and should probably be promoted to become named inner classes.
2015-08-09 05:27:09 +03:00
Michal Kordas 2915ccf21a Add SuppressWarnings for known deprecation. #1555
Fixes `Deprecation` inspection violation.

Description:
>This inspection reports where deprecated code is used in the specified inspection scope.
2015-08-09 05:25:45 +03:00
Michal Kordas ee1b845b79 Remove redundant toString() calls. #1555
Fixes `UnnecessaryToStringCall` inspection violations.

Description:
>Reports on any calls to toString() used in string concatenations and as arguments to the print() and println() methods of java.io.PrintWriter and java.io.PrintStream, the append() method of java.lang.StringBuilder and java.lang.StringBuffer or the trace(), debug(), info(), warn() and error() methods of org.slf4j.Logger. In these cases the conversion to string will be handled by the underlying library methods and an explicit call to toString() is no needed.
 Note that without the toString() call the expression will have slightly different semantics (the string null will be used instead of throwing a NullPointerException).
2015-08-09 05:24:15 +03:00
Michal Kordas c8761822c4 Remove unnecessary enum modifiers. #1555
Fixes `UnnecessaryEnumModifier` inspection violations.

Description:
>Reports on any redundant modifiers on enumerated classes or components of enumerated classes.
2015-08-09 05:22:59 +03:00
Michal Kordas 40684b5eba Add additional suppression for unchecked operation. #1555
Fixes `UNCHECKED_WARNING` inspection violations.

Description:
>Unchecked overriding: return type requires unchecked conversion. Found 'java.lang.Object', required 'T' (at line 251).
Signals places where an unchecked warning is issued by the compiler, for example:
```
void f(HashMap map) {
  map.put("key", "value");
  }
```
2015-08-09 05:21:38 +03:00
Michal Kordas 66bcf5ddd0 Remove redundant empty method. #1555
Fixes `RedundantMethodOverride` inspection violation.

Description:
>Reports any method that has a body and signature that are identical to its super method. Such a method is redundant and probably a coding error.
2015-08-09 05:20:16 +03:00
Michal Kordas bf4e38c0c4 Remove redundant and confusing else. #1555
Fixes `ConfusingElse` inspection violation.

Description:
>Reports confusing else branches. else branches are confusing when the if statement is followed by other statements and the if branch cannot complete normally, for example because it ends with a return statement. In these cases the statements in the else can be moved after the if statement and the else branch removed.
2015-08-09 05:16:31 +03:00
Michal Kordas 582751d04e Use adapter instead of listener. #1555
Fixes `ListenerMayUseAdapter` inspection violations.

Description:
>Reports any classes which implement a listener, but may extend the corresponding adapter instead. The quickfix for this inspection will also remove any redundant empty methods left over after replacing the implementation of the listener with an extension of the corresponding adapter.
2015-08-09 05:14:48 +03:00
Michal Kordas e70960913c Mark methods final if they are used in constructors. #1555
Fixes `OverridableMethodCallDuringObjectConstruction` inspection violations.

Description:
>Reports any calls to overridable methods of the current class during object construction. A call is during object construction if it is made inside a constructor, in an non-static instance initializer, in a non-static field initializer or inside a clone(), readObject() or readObjectNoData() method. Methods are overridable if they are not declared final, static or private. Such calls may result in subtle bugs, as the object is not guaranteed to be initialized before the method call occurs.
2015-08-09 05:13:20 +03:00
Michal Kordas b5a5bbdb6d Remove usage of Cloneable from Javadoc. #1555
Fixes `UseOfClone` inspection violation.

Description:
>Reports calls to and implementations of the clone() method and uses of java.lang.Cloneable. Some coding standards prohibit clone() usage, and recommend using a copy constructor or static factory method. Calls to clone() on arrays are ignored, because that is a common, correct, efficient and compact way to copy an array.
2015-08-09 05:09:00 +03:00
Michal Kordas ba16b1537f Do not ignore stacktrace of previous exception. #1555
Fixes `ExceptionFromCatchWhichDoesntWrap` inspection violation.

Description:
>Reports exceptions constructed and thrown from inside catch blocks, which do not "wrap" the caught exception. It is considered good practice when throwing an exception in response to an exception to wrap the initial exception, so that valuable context information such as stack frames and line numbers are not lost.
2015-08-09 05:07:42 +03:00
Michal Kordas 2d246f7647 Make class final. #1555
Fixes `NonFinalUtilityClass` inspection violation.

Description:
>Reports utility classes which are not final. Utility classes have all fields and methods declared static. Giving such classes making them final prevents them from being inadvertently subclassed.
2015-08-09 05:05:59 +03:00
Michal Kordas 8046febbdf Fix Javadoc problems. #1555
Fixes `JavaDoc` inspection violations.

Description:
>This inspection points out the following javadoc comment flaws:
- no javadoc where it is required
- required tag is missing
- invalid or incomplete tag
- javadoc description is missing or incomplete
2015-08-09 05:04:52 +03:00
Michal Kordas b5825ca34c Fix incorrect references in Javadoc. #1555
Fixes `JavadocReference` inspection violations.

Description:
>This inspection points out unresolved references inside javadoc
2015-08-09 05:03:37 +03:00
Michal Kordas 261e9a2bab Make field final. #1555
Fixes `CanBeFinal` inspection violation.

Description:
>This inspection reports all fields, methods or classes, found in the specified inspection scope, that may have a final modifier added to their declarations.
2015-08-09 05:00:08 +03:00
Michal Kordas d9829fa230 Remove unnecessary Javadoc tags. #1555
Fixes `UnnecessaryJavaDocLink` inspection violations.

Description:
>Reports any Javadoc @see, {@link} and {@linkplain} tags which reference the method owning the comment, the super method of the method owning the comment or the class containing the comment. Such links are unnecessary and can be safely removed using this inspections quickfix. The quickfix will remove the entire Javadoc comment if the link is its only content.
2015-08-09 04:57:40 +03:00
Michal Kordas 3abc77ef3b Hide package-visible instance fields. #1555
Fixes `PackageVisibleField` inspection violation.

Description:
>Reports package-visible instance variables. Constants (i.e. variables marked static and final) are not reported.
2015-08-09 04:55:24 +03:00
Michal Kordas d0ecc8cfbb Remove redundant abstract methods declarations. #1555
Fixes `AbstractMethodOverridesAbstractMethod` inspection violations.

Description:
>Reports abstract methods which override abstract methods. Methods with different return types or exception declarations than the method they override are not reported by this inspection.
2015-08-09 04:53:52 +03:00
Michal Kordas 70d4949aae Use protected constructors in abstract classes. #1555
Fixes `NonProtectedConstructorInAbstractClass` inspection violations.

Description:
>Reports constructors in abstract classes that are not declared protected, package-protected or private.
2015-08-09 04:52:08 +03:00
Michal Kordas f94f277e9c Simplify if statement. #1555 2015-08-09 04:50:15 +03:00
Michal Kordas f92ea5787d Optimize single character starts with. #1555
Fixes `SingleCharacterStartsWith` inspection violations.

False-negative reported to PMD: https://sourceforge.net/p/pmd/bugs/1392
2015-08-09 04:48:12 +03:00
Michal Kordas 4d6e2376db Move constants to left side of comparison. #1555
Fixes `ConstantOnLHSOfComparison` inspection violations.

Description:
>Reports on comparison operations with constant values on their left-hand side. Some coding conventions specify that constants should be on the right-hand side of comparisons.
2015-08-09 04:46:20 +03:00
Michal Kordas e5ec819a74 Replace magic constant occurrences with proper constants. #1555
Fixes MagicConstant violations.

 Description:
> Report occurrences where usages of "magic" constants only are allowed but other expressions are used instead. E.g. new Font("Arial", 2 ) // not allowed instead of new Font("Arial", Font. ITALIC ) // OK   Please see org.intellij.lang.annotations.MagicConstant annotation description for details.
2015-08-09 04:37:34 +03:00
Aleksandr Ivanov 70c83141b4 Changed SAME_PACKAGE rule for CustomImportOrderCheck #1262 2015-08-08 13:01:50 +03:00
Andrei Selkin 2da1686445 Added CommentsIndentationCheck into checkstyle_checks.xml, issue #333. 2015-08-08 11:54:21 +03:00
Andrei Selkin df5eac3757 Added new Check: CommentsIndentationCheck, issue #333 2015-08-08 11:54:21 +03:00
Andrei Selkin 186625600d Resolved javadoc problems that reported by java 8, issue #291. 2015-08-08 08:23:32 +03:00
Michal Kordas f249163027 Replace RuntimeException with IllegalStateException. #1555
Fixes `BadExceptionThrown` inspection violations.

Description:
>Reports throw statements which throw inappropriate exceptions. One use of this inspection would be to warn of throw statements which throw overly generic exceptions (e.g. java.lang.Exception or java.io.IOException).
2015-08-08 08:19:16 +03:00
Michal Kordas 0c61e5d7a5 Remove unchecked exception from throws. #1555
Fixes `ThrowsRuntimeException` inspection violation.

Description:
Reports declarations of unchecked exceptions (RuntimeException and its subclasses) in the throws clause of a method. Declaration of unchecked exceptions are not required and may be removed or moved to a Javadoc @throws tag.
2015-08-08 08:18:30 +03:00
Michal Kordas 4fd298b001 Rename ignored catch parameters. #1555
Fixes `UnusedCatchParameter` inspection violations.

Description:
Reports any catch parameters that are unused in their corresponding blocks. This inspection will not report any catch parameters named "ignore" or "ignored". Conversely this inspection will warn on any catch parameters named "ignore" or "ignored" that are actually used.
2015-08-08 08:17:41 +03:00
Michal Kordas bf6735ce4b Use StringBuilder to concatenate strings. #1555
Fixes `StringReplaceableByStringBuffer` inspection violations.

Description:
Reports any variables declared as java.lang.String which are repeatedly appended to. Such variables may be more efficiently declared as java.lang.StringBuffer or java.lang.StringBuilder.
2015-08-08 08:14:58 +03:00
Michal Kordas b550547318 Make method static. #1555
Fixes `MethodMayBeStatic` inspection violation.

Description:
>Reports any methods which may safely be made static. A method may be static if it is not synchronized, it does not reference any of its class' non static methods and non static fields and is not overridden in a sub class.
2015-08-08 08:14:05 +03:00
Michal Kordas 084809c3b9 Simplify empty string check. #1555
Fixes `Simplify empty string check` inspection violations.

Description:
>Reports .equals() being called to compare a String with an empty string. It is normally more performant to test a String for emptiness by comparing its .length() to zero instead.
2015-08-08 08:11:31 +03:00
Michal Kordas 717ba0311d Replace toArray() argument with correctly sized array. #1555
Fixes `ToArrayCallWithZeroLengthArrayArgument` inspection violation.

Description:
>Reports any call to toArray() on an object of type or subtype java.util.Collection with a zero-length array argument. When passing in an array of too small size, the toArray() method has to construct a new array of the right size using reflection. This has significantly worse performance than passing in an array of at least the size of the collection itself.
2015-08-08 08:10:24 +03:00