Applied patch (1505376) by Clint Stotesbery to support the
suppressLoadErrors property for AbstractTypeAwareCheck (RFE 1491630).
This commit is contained in:
parent
0a72322796
commit
104e69edd6
|
|
@ -79,6 +79,22 @@ public abstract class AbstractTypeAwareCheck extends Check
|
|||
mLogLoadErrors = aLogLoadErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to show class loading errors in the checkstyle report.
|
||||
* Request ID 1491630
|
||||
*/
|
||||
private boolean mSuppressLoadErrors;
|
||||
|
||||
/**
|
||||
* Controls whether to show class loading errors in the checkstyle report.
|
||||
*
|
||||
* @param aSuppressLoadErrors true if errors shouldn't be shown
|
||||
*/
|
||||
public final void setSuppressLoadErrors(boolean aSuppressLoadErrors)
|
||||
{
|
||||
mSuppressLoadErrors = aSuppressLoadErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to process an AST when visiting it.
|
||||
* @param aAST the AST to process. Guaranteed to not be PACKAGE_DEF or
|
||||
|
|
@ -263,7 +279,6 @@ public abstract class AbstractTypeAwareCheck extends Check
|
|||
protected final void logLoadErrorImpl(int aLineNo, int aColumnNo,
|
||||
String aMsgKey, Object[] aValues)
|
||||
{
|
||||
System.out.println(mLogLoadErrors);
|
||||
if (!mLogLoadErrors) {
|
||||
LocalizedMessage msg = new LocalizedMessage(aLineNo,
|
||||
aColumnNo,
|
||||
|
|
@ -275,7 +290,10 @@ public abstract class AbstractTypeAwareCheck extends Check
|
|||
this.getClass());
|
||||
throw new RuntimeException(msg.getMessage());
|
||||
}
|
||||
log(aLineNo, aColumnNo, aMsgKey, aValues);
|
||||
|
||||
if (!mSuppressLoadErrors) {
|
||||
log(aLineNo, aColumnNo, aMsgKey, aValues);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -958,6 +958,32 @@ for (int i = 0; i < 1; i++) {
|
|||
<td><a href="property_types.html#boolean">boolean</a></td>
|
||||
<td><span class="default">false</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>logLoadErrors</td>
|
||||
<td>This check may need to load exception classes mentioned in
|
||||
the @throws tag to check whether they are RuntimeExceptions.
|
||||
If loading the class fails, this property allows to control
|
||||
checkstyle's error handling. If set to false (the default) a
|
||||
classpath configuration problem is assumed and the TreeWalker
|
||||
stops operating on the class completely.
|
||||
If set to true, checkstyle assumes a typo or refactoring problem in the
|
||||
javadoc and logs the problem in the normal checkstyle report
|
||||
(potentially masking a configuration error).</td>
|
||||
<td><a href="property_types.html#boolean">boolean</a></td>
|
||||
<td><span class="default">false</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>suppressLoadErrors</td>
|
||||
<td>When logLoadErrors is set to true, the TreeWalker completely
|
||||
processes a class and displays any problems with loading exceptions
|
||||
as checkstyle violations.
|
||||
When this property is set to true, the violations generated when
|
||||
logLoadErrors is set true are suppressed from being reported as
|
||||
violations in the checkstyle report.
|
||||
</td>
|
||||
<td><a href="property_types.html#boolean">boolean</a></td>
|
||||
<td><span class="default">false</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</subsection>
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@
|
|||
declared, set property allowUndeclaredRTE to true. The scope
|
||||
to verify is specified using the <code>Scope</code> class and
|
||||
defaults to <code>Scope.PRIVATE</code>. To verify another
|
||||
scope, set property scope to a different
|
||||
scope, set property scope to a different
|
||||
<a href="property_types.html#scope">scope</a>.
|
||||
</p>
|
||||
|
||||
|
|
@ -322,10 +322,10 @@ public boolean isSomething()
|
|||
</tr>
|
||||
<tr>
|
||||
<td>logLoadErrors</td>
|
||||
<td>This check may needs to load exception classes mentioned in
|
||||
<td>This check may need to load exception classes mentioned in
|
||||
the @throws tag to check whether they are RuntimeExceptions.
|
||||
If loading the class fails, this property allows to control
|
||||
checkstyle's error handling. If set to false (the default) a
|
||||
checkstyle's error handling. If set to false (the default) a
|
||||
classpath configuration problem is assumed and the TreeWalker
|
||||
stops operating on the class completely.
|
||||
If set to true, checkstyle assumes a typo or refactoring problem in the
|
||||
|
|
@ -334,7 +334,18 @@ public boolean isSomething()
|
|||
<td><a href="property_types.html#boolean">boolean</a></td>
|
||||
<td><span class="default">false</span></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>suppressLoadErrors</td>
|
||||
<td>When logLoadErrors is set to true, the TreeWalker completely
|
||||
processes a class and displays any problems with loading exceptions
|
||||
as checkstyle violations.
|
||||
When this property is set to true, the violations generated when
|
||||
logLoadErrors is set true are suppressed from being reported as
|
||||
violations in the checkstyle report.
|
||||
</td>
|
||||
<td><a href="property_types.html#boolean">boolean</a></td>
|
||||
<td><span class="default">false</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tokens</td>
|
||||
<td>definitions to check</td>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@
|
|||
King. (Bug 1385095).
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Applied patch (1505376) by Clint Stotesbery to support the
|
||||
suppressLoadErrors property for AbstractTypeAwareCheck (RFE
|
||||
1491630).
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Upgraded to ANTLR 2.7.6.
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue