One more fix for Indentation check and enums (bug 1193850)

This commit is contained in:
Oleg Sukhodolsky 2005-05-04 14:49:12 +00:00
parent 0c3c817b22
commit edd5ba536d
3 changed files with 65 additions and 1 deletions

View File

@ -90,10 +90,13 @@ public class ObjectBlockHandler extends BlockParentHandler
public IndentLevel getLevelImpl()
{
DetailAST parentAST = getMainAst().getParent();
final IndentLevel indent = getParent().getLevel();
IndentLevel indent = getParent().getLevel();
if (parentAST.getType() == TokenTypes.LITERAL_NEW) {
indent.addAcceptedIndent(super.getLevelImpl());
}
else if (parentAST.getType() == TokenTypes.ENUM_CONSTANT_DEF) {
indent = super.getLevelImpl();
}
return indent;
}

View File

@ -69,3 +69,61 @@ public class InputValidBlockIndent {
}
public enum EquivalenceTester {
/**
* An equivalence tester that decides based on {@link Object#equals(Object) equals}.
*/
OBJECT_ATTRIBUTES {
/**
* {@inheritDoc}
*/
public boolean areEqual( final Object first, final Object second ) {
return Objects.areEqual( first, second );
}
/**
* {@inheritDoc}
*/
public int hashCode( final Object target ) {
return Objects.nullSafeHashCode( target );
}
},
/**
* An equivalence tester that decides based on {@code ==}.
*/
OBJECT_IDENTITIES
{
/**
* {@inheritDoc}
*/
public boolean areEqual( final Object first, final Object second ) {
return first == second;
}
/**
* {@inheritDoc}
*/
public int hashCode( final Object target ) {
return System.identityHashCode( target );
}
};
/**
* Tells whether the two given objects are considered equivalent.
*
* @param first first comparand
* @param second second comparand
* @return whether {@code first} and {@code second} are considered equivalent
*/
public abstract boolean areEqual( Object first, Object second );
/**
* Computes a hash code for the given object.
*
* @param target object to compute a hash for
* @return the computed hash
*/
public abstract int hashCode( Object target );
}

View File

@ -17,6 +17,9 @@
<li>DesignForExtension check skips enums now (they are final
:). (bug# 1194470)</li>
<li>One more fix for Indentation check and enums (bug
1193850)</li>
</ul>
</section>