[ONOS-4616] YANG grouping linker issues fixed.
Change-Id: I741aa9ad1008c02c9a9f90cc117cd43729132129
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
index e1d0e68..613237a 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedInfo.java
@@ -225,9 +225,7 @@
* @throws DataModelException a violation in data mode rule
*/
public ResolvableStatus resolve() throws DataModelException {
-
YangType<?> baseType = getReferredTypeDef().getTypeDefBaseType();
-
/*
* Checks the data type of the referred typedef, if it's derived,
* obtain effective built-in type and restrictions from it's derived
@@ -240,7 +238,6 @@
if (baseType.getResolvableStatus() != INTRA_FILE_RESOLVED && baseType.getResolvableStatus() != RESOLVED) {
throw new DataModelException("Linker Error: Referred typedef is not resolved for type.");
}
-
/*
* Check if the referred typedef is intra file resolved, if yes sets
* current status also to intra file resolved .
@@ -250,7 +247,7 @@
}
setEffectiveBuiltInType(((YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo())
.getEffectiveBuiltInType());
- YangDerivedInfo refDerivedInfo = ((YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo());
+ YangDerivedInfo refDerivedInfo = (YangDerivedInfo<?>) baseType.getDataTypeExtendedInfo();
/*
* Check whether the effective built-in type can have range
* restrictions, if yes call resolution of range.
@@ -327,7 +324,7 @@
}
}
} else {
- setEffectiveBuiltInType((baseType.getDataType()));
+ setEffectiveBuiltInType(baseType.getDataType());
/*
* Check whether the effective built-in type can have range
* restrictions, if yes call resolution of range.
@@ -404,7 +401,6 @@
}
}
}
-
/*
* Check if the data type is the one which can't be restricted, in
* this case check whether no self restrictions should be present.
@@ -418,7 +414,6 @@
throw new DataModelException("YANG file error: Restrictions can't be applied to a given type");
}
}
-
// Throw exception for unsupported types
throw new DataModelException("Linker error: Unable to process the derived type.");
}
@@ -438,7 +433,7 @@
* Check that range restriction should be null when built-in type is
* string.
*/
- if (!(Strings.isNullOrEmpty(getRangeRestrictionString()))) {
+ if (!Strings.isNullOrEmpty(getRangeRestrictionString())) {
DataModelException dataModelException = new DataModelException("YANG file error: Range restriction " +
"should't be present for string data type.");
dataModelException.setLine(lineNumber);
@@ -605,7 +600,7 @@
* Check that string restriction should be null when built-in type is
* of range type.
*/
- if (!(Strings.isNullOrEmpty(getLengthRestrictionString())) || getPatternRestriction() != null) {
+ if (!Strings.isNullOrEmpty(getLengthRestrictionString()) || getPatternRestriction() != null) {
DataModelException dataModelException = new DataModelException("YANG file error: Length/Pattern " +
"restriction should't be present for int/uint/decimal data type.");
dataModelException.setLine(lineNumber);
@@ -660,12 +655,12 @@
* @return true, if data type can't be restricted, false otherwise
*/
private boolean isOfValidNonRestrictedType(YangDataTypes dataType) {
- return (dataType == BOOLEAN
+ return dataType == BOOLEAN
|| dataType == ENUMERATION
|| dataType == BITS
|| dataType == EMPTY
|| dataType == UNION
|| dataType == IDENTITYREF
- || dataType == LEAFREF);
+ || dataType == LEAFREF;
}
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
index 2fc88c0..26df1f5 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -271,6 +271,7 @@
*
* @return the list of imported modules
*/
+ @Override
public List<YangImport> getImportList() {
return importList;
}
@@ -280,6 +281,7 @@
*
* @param importedModule module being imported
*/
+ @Override
public void addToImportList(YangImport importedModule) {
getImportList().add(importedModule);
}
@@ -294,6 +296,7 @@
*
* @return the included list of sub modules
*/
+ @Override
public List<YangInclude> getIncludeList() {
return includeList;
}
@@ -303,6 +306,7 @@
*
* @param includeModule submodule being included
*/
+ @Override
public void addToIncludeList(YangInclude includeModule) {
getIncludeList().add(includeModule);
}
@@ -393,6 +397,7 @@
*
* @return the prefix
*/
+ @Override
public String getPrefix() {
return prefix;
}
@@ -402,6 +407,7 @@
*
* @param prefix the prefix to set
*/
+ @Override
public void setPrefix(String prefix) {
this.prefix = prefix;
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
index bf442a1..7a54aaf 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -285,6 +285,7 @@
*
* @return the list of imported modules
*/
+ @Override
public List<YangImport> getImportList() {
return importList;
}
@@ -294,6 +295,7 @@
*
* @param importedModule module being imported
*/
+ @Override
public void addToImportList(YangImport importedModule) {
getImportList().add(importedModule);
}
@@ -308,6 +310,7 @@
*
* @return the included list of sub modules
*/
+ @Override
public List<YangInclude> getIncludeList() {
return includeList;
}
@@ -317,6 +320,7 @@
*
* @param includeModule submodule being included
*/
+ @Override
public void addToIncludeList(YangInclude includeModule) {
getIncludeList().add(includeModule);
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
index a295b48..fe5cda1 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
@@ -187,7 +187,7 @@
* @return the data type
*/
public YangType<?> getTypeDefBaseType() {
- if (!(getTypeList().isEmpty())) {
+ if (!getTypeList().isEmpty()) {
return getTypeList().get(0);
}
return null;
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
index f6a5e6b..4eae3a2 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
@@ -271,8 +271,8 @@
}
YangNode usesParentNode = getParentNodeInGenCode(this);
- if ((!(usesParentNode instanceof YangLeavesHolder))
- || (!(usesParentNode instanceof CollisionDetector))) {
+ if (!(usesParentNode instanceof YangLeavesHolder)
+ || !(usesParentNode instanceof CollisionDetector)) {
throw new LinkerException("Linker Exception: YANG uses holder construct is wrong");
}