We should emit a warning when a model attempts to override
fraction-digits from a base type.
Change-Id: I2aa801288fff8894cc8b8afe22f27c19630e2331
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DeclaredEffectiveStatementBase;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.FractionDigitsEffectiveStatementImpl;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.UnknownEffectiveStatementImpl;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DeclaredEffectiveStatementBase;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.FractionDigitsEffectiveStatementImpl;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.UnknownEffectiveStatementImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public final class DecimalTypeEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, TypeStatement>
implements TypeEffectiveStatement<TypeStatement> {
public final class DecimalTypeEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, TypeStatement>
implements TypeEffectiveStatement<TypeStatement> {
+ private static final Logger LOG = LoggerFactory.getLogger(Decimal64SpecificationEffectiveStatementImpl.class);
private final DecimalTypeDefinition typeDefinition;
public DecimalTypeEffectiveStatementImpl(
private final DecimalTypeDefinition typeDefinition;
public DecimalTypeEffectiveStatementImpl(
}
if (stmt instanceof FractionDigitsEffectiveStatementImpl) {
final Integer digits = ((FractionDigitsEffectiveStatementImpl)stmt).argument();
}
if (stmt instanceof FractionDigitsEffectiveStatementImpl) {
final Integer digits = ((FractionDigitsEffectiveStatementImpl)stmt).argument();
-// FIXME: activate this and fix models
-// if (!baseType.getFractionDigits().equals(digits)) {
-// throw new SourceException(String.format("Cannot override fraction-digits from base type %s",
-// baseType), ctx.getStatementSourceReference());
-// }
+
+ if (!baseType.getFractionDigits().equals(digits)) {
+ LOG.warn("Ignoring attempt to override fraction-digits to {} at {}, base type is {}", digits,
+ ctx.getStatementSourceReference(), baseType);
+
+ // FIXME: promote to a full error once our models are fixed
+ // throw new SourceException(String.format("Cannot override fraction-digits from base type %s",
+ // baseType), ctx.getStatementSourceReference());
+ }