Source:
<code>private List<ObjectPropertyPath> getObjectPropertyPathList(Annotation comparatorDefinition) { ComparatorDefinitionAnnotationValueHandler comparatorAnnotationHandler = new ComparatorDefinitionAnnotationValueHandler(comparatorDefinition); List<ObjectPropertyPath> objectPropertyPathList = new ArrayList<>(); List<Annotation> comparatorFieldPaths = comparatorAnnotationHandler.getObjectPropertyPaths(); for (Annotation comparatorFieldPath : comparatorFieldPaths) { ObjectPropertyPath objectPropertyPath = new ObjectPropertyPathImpl(); objectPropertyPath.setDescending(!comparatorAnnotationHandler.isAscending(comparatorFieldPath)); List<Annotation> comparatorFields = comparatorAnnotationHandler.getObjectProperties(comparatorFieldPath); if (!comparatorFields.isEmpty()) { String objectPropertyName = comparatorAnnotationHandler.getName(comparatorFields.get(0)); ObjectProperty objectProperty = dataObject.getProperty(objectPropertyName); if (objectProperty == null) { throw new IllegalStateException(dataObject.getName() + "Comparator: Property " + objectPropertyName + " not found in data object " + dataObject.getClassName()); } objectPropertyPath.appendObjectProperty(objectProperty); for (int i = 1; i < comparatorFields.size(); i++) { objectPropertyName = comparatorAnnotationHandler.getName(comparatorFields.get(i)); ObjectProperty lastObjectPropertyInPath = objectPropertyPath.getObjectPropertyPath().get(objectPropertyPath.getObjectPropertyPath().size() - 1); if (lastObjectPropertyInPath == null) { throw new IllegalStateException(dataObject.getName() + "Comparator: Data object not found"); <START> } <END> if (lastObjectPropertyInPath.isBaseType() || lastObjectPropertyInPath.isPrimitiveType()) { throw new IllegalStateException(dataObject.getName() + "Comparator: Cannot append property " + objectPropertyName + " to primitive/base type " + lastObjectPropertyInPath.getClassName()); } DataObject lastDataObjectInPath = getContext().getDataModel().getDataObject(lastObjectPropertyInPath.getClassName()); ObjectProperty currentObjectProperty = lastDataObjectInPath.getProperty(objectPropertyName); if (currentObjectProperty == null) { throw new IllegalStateException(dataObject.getName() + "Comparator: Property " + objectPropertyName + " not found in data object " + lastDataObjectInPath.getClassName()); } objectPropertyPath.appendObjectProperty(currentObjectProperty); } } objectPropertyPathList.add(objectPropertyPath); } return objectPropertyPathList; }</code><technical_language>This null check is redundant lastObjectPropertyInPath is null</technical_language>

Target:
private List<ObjectPropertyPath> getObjectPropertyPathList(Annotation comparatorDefinition) { ComparatorDefinitionAnnotationValueHandler comparatorAnnotationHandler = new ComparatorDefinitionAnnotationValueHandler(comparatorDefinition); List<ObjectPropertyPath> objectPropertyPathList = new ArrayList<>(); List<Annotation> comparatorFieldPaths = comparatorAnnotationHandler.getObjectPropertyPaths(); for (Annotation comparatorFieldPath : comparatorFieldPaths) { ObjectPropertyPath objectPropertyPath = new ObjectPropertyPathImpl(); objectPropertyPath.setDescending(!comparatorAnnotationHandler.isAscending(comparatorFieldPath)); List<Annotation> comparatorFields = comparatorAnnotationHandler.getObjectProperties(comparatorFieldPath); if (!comparatorFields.isEmpty()) { String objectPropertyName = comparatorAnnotationHandler.getName(comparatorFields.get(0)); ObjectProperty objectProperty = dataObject.getProperty(objectPropertyName); if (objectProperty == null) { throw new IllegalStateException(dataObject.getName() + "Comparator: Property " + objectPropertyName + " not found in data object " + dataObject.getClassName()); } objectPropertyPath.appendObjectProperty(objectProperty); for (int i = 1; i < comparatorFields.size(); i++) { objectPropertyName = comparatorAnnotationHandler.getName(comparatorFields.get(i)); ObjectProperty lastObjectPropertyInPath = objectPropertyPath.getObjectPropertyPath().get(objectPropertyPath.getObjectPropertyPath().size() - 1); if (lastObjectPropertyInPath.isBaseType() || lastObjectPropertyInPath.isPrimitiveType()) { throw new IllegalStateException(dataObject.getName() + "Comparator: Cannot append property " + objectPropertyName + " to primitive/base type " + lastObjectPropertyInPath.getClassName()); } DataObject lastDataObjectInPath = getContext().getDataModel().getDataObject(lastObjectPropertyInPath.getClassName()); if (lastDataObjectInPath == null) { throw new IllegalStateException(dataObject.getName() + "Comparator: Data object " + lastObjectPropertyInPath.getClassName() + " not found"); } ObjectProperty currentObjectProperty = lastDataObjectInPath.getProperty(objectPropertyName); if (currentObjectProperty == null) { throw new IllegalStateException(dataObject.getName() + "Comparator: Property " + objectPropertyName + " not found in data object " + lastDataObjectInPath.getClassName()); } objectPropertyPath.appendObjectProperty(currentObjectProperty); } } objectPropertyPathList.add(objectPropertyPath); } return objectPropertyPathList; }