fix for 1193855 (Spurious java.lang.NullPointerExceptions during processing)
This commit is contained in:
parent
edd5ba536d
commit
3d8fc87ef6
|
|
@ -50,13 +50,23 @@ public class ForHandler extends BlockParentHandler
|
|||
IndentLevel expected = new IndentLevel(getLevel(), getBasicOffset());
|
||||
|
||||
DetailAST init = getMainAst().findFirstToken(TokenTypes.FOR_INIT);
|
||||
checkExpressionSubtree(init, expected, false, false);
|
||||
if (init != null) {
|
||||
checkExpressionSubtree(init, expected, false, false);
|
||||
|
||||
DetailAST cond = getMainAst().findFirstToken(TokenTypes.FOR_CONDITION);
|
||||
checkExpressionSubtree(cond, expected, false, false);
|
||||
DetailAST cond =
|
||||
getMainAst().findFirstToken(TokenTypes.FOR_CONDITION);
|
||||
checkExpressionSubtree(cond, expected, false, false);
|
||||
|
||||
DetailAST iter = getMainAst().findFirstToken(TokenTypes.FOR_ITERATOR);
|
||||
checkExpressionSubtree(iter, expected, false, false);
|
||||
DetailAST iter =
|
||||
getMainAst().findFirstToken(TokenTypes.FOR_ITERATOR);
|
||||
checkExpressionSubtree(iter, expected, false, false);
|
||||
}
|
||||
// for each
|
||||
else {
|
||||
DetailAST forEach =
|
||||
getMainAst().findFirstToken(TokenTypes.FOR_EACH_CLAUSE);
|
||||
checkExpressionSubtree(forEach, expected, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class InputValidBlockIndent {
|
|||
|
||||
}
|
||||
|
||||
public enum EquivalenceTester {
|
||||
enum EquivalenceTester {
|
||||
/**
|
||||
* An equivalence tester that decides based on {@link Object#equals(Object) equals}.
|
||||
*/
|
||||
|
|
@ -79,14 +79,14 @@ public enum EquivalenceTester {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean areEqual( final Object first, final Object second ) {
|
||||
return Objects.areEqual( first, second );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public int hashCode( final Object target ) {
|
||||
return Objects.nullSafeHashCode( target );
|
||||
return 1;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -127,3 +127,13 @@ final class InputValidClassDefIndent6 extends java.awt.event.MouseAdapter implem
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
class HashingContainer<K, V> {
|
||||
// @Deprecated
|
||||
public Object[] table;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class InputValidForIndent {
|
|||
}
|
||||
|
||||
|
||||
private void method1()
|
||||
private void method1(int[] indices)
|
||||
{
|
||||
for (int i=0; i<10; i++)
|
||||
System.getProperty("foo");
|
||||
|
|
@ -73,6 +73,13 @@ public class InputValidForIndent {
|
|||
) {
|
||||
System.getProperty("foo");
|
||||
}
|
||||
|
||||
|
||||
for ( final int index : indices ) {
|
||||
System.err.println(index);
|
||||
}
|
||||
for ( final int index : indices )
|
||||
{
|
||||
System.err.println(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
<li>DesignForExtension check skips enums now (they are final
|
||||
:). (bug# 1194470)</li>
|
||||
|
||||
<li>One more fix for Indentation check and enums (bug
|
||||
1193850)</li>
|
||||
<li>Indentation check now works better with enums and
|
||||
for-each statements (bugs 1193850 and 1193855)</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue