- returnValueLoc =
- inferRelationsFromExpressionNode(md, nametable, returnExp, new CompositeLocation(),
- constraint, false);
-
- // if this return statement is inside branch, return value has an implicit
- // flow from conditional location
- if (constraint != null) {
- Set<CompositeLocation> inputGLB = new HashSet<CompositeLocation>();
- inputGLB.add(returnValueLoc);
- inputGLB.add(constraint);
- returnValueLoc =
- CompositeLattice.calculateGLB(inputGLB, generateErrorMessage(md.getClassDesc(), rn));
- }
-
- // check if return value is equal or higher than RETRUNLOC of method
- // declaration annotation
- CompositeLocation declaredReturnLoc = md2ReturnLoc.get(md);
-
- int compareResult =
- CompositeLattice.compare(returnValueLoc, declaredReturnLoc, false,
- generateErrorMessage(md.getClassDesc(), rn));
-
- if (compareResult == ComparisonResult.LESS || compareResult == ComparisonResult.INCOMPARABLE) {
- throw new Error(
- "Return value location is not equal or higher than the declaraed return location at "
- + md.getClassDesc().getSourceFileName() + "::" + rn.getNumLine());
- }
- }
-
- return new CompositeLocation();
- }
-
- private boolean hasOnlyLiteralValue(ExpressionNode en) {
- if (en.kind() == Kind.LiteralNode) {
- return true;
- } else {
- return false;