Package edu.cmu.cs.crystal.annotations

Examples of edu.cmu.cs.crystal.annotations.AnnotationSummary


      TupleLatticeElement<Variable, NullLatticeElement> beforeTuple = flowAnalysis.getResultsBefore(node);
     
      if (node.getExpression() != null)
        checkVariable(beforeTuple, node.getExpression());
     
      AnnotationSummary summary = getInput().getAnnoDB().getSummaryForMethod(node.resolveMethodBinding());
     
      for (int ndx = 0; ndx < node.arguments().size(); ndx++) { 
        if (summary.getParameter(ndx, NON_NULL_ANNO) != null) //is this parameter annotated with @Nonnull?
          checkVariable(beforeTuple, (Expression) node.arguments().get(ndx));
      }
    }
View Full Code Here


      if (left instanceof Name && ((Name)left).resolveBinding() instanceof IVariableBinding) {
        IVariableBinding binding = (IVariableBinding) ((Name)left).resolveBinding();
     
        if (binding.isParameter()) {
          IMethodBinding method = Utilities.getMethodDeclaration(node).resolveBinding();
          AnnotationSummary summary = getInput().getAnnoDB().getSummaryForMethod(method);
       
          if (summary.getParameter(binding.getName(), NON_NULL_ANNO) != null)
            checkVariable(flowAnalysis.getResultsBefore(left), right);
        }
      }
    }
View Full Code Here

      TupleLatticeElement<Variable, NullLatticeElement> beforeTuple = flowAnalysis.getResultsBefore(node);
     
      if (node.getExpression() != null)
        checkVariable(beforeTuple, node.getExpression());
     
      AnnotationSummary summary = getInput().getAnnoDB().getSummaryForMethod(node.resolveMethodBinding());
     
      for (int ndx = 0; ndx < node.arguments().size(); ndx++) { 
        if (summary.getParameter(ndx, NON_NULL_ANNO) != null) //is this parameter annotated with @Nonnull?
          checkVariable(beforeTuple, (Expression) node.arguments().get(ndx));
      }
    }
View Full Code Here

      if (left instanceof Name && ((Name)left).resolveBinding() instanceof IVariableBinding) {
        IVariableBinding binding = (IVariableBinding) ((Name)left).resolveBinding();
     
        if (binding.isParameter()) {
          IMethodBinding method = Utilities.getMethodDeclaration(node).resolveBinding();
          AnnotationSummary summary = getInput().getAnnoDB().getSummaryForMethod(method);
       
          if (summary.getParameter(binding.getName(), NON_NULL_ANNO) != null)
            checkVariable(flowAnalysis.getResultsBefore(left), right);
        }
      }
    }
View Full Code Here

  public TupleLatticeElement<Variable, NullLatticeElement> createEntryValue(
      MethodDeclaration method) {
    TupleLatticeElement<Variable, NullLatticeElement> def = ops.getDefault();
    def.put(getAnalysisContext().getThisVariable(), NullLatticeElement.NOT_NULL);
   
    AnnotationSummary summary = annoDB.getSummaryForMethod(method.resolveBinding());
   
    for (int ndx = 0; ndx < method.parameters().size(); ndx++) {
      SingleVariableDeclaration decl = (SingleVariableDeclaration) method.parameters().get(ndx);
      Variable paramVar = getAnalysisContext().getSourceVariable(decl.resolveBinding());
     
      if (summary.getParameter(ndx, BranchingNPEAnalysis.NON_NULL_ANNO) != null) //is this parameter annotated with @Nonnull?
        def.put(paramVar, NullLatticeElement.NOT_NULL);
    }
   
    return def;
  }
View Full Code Here

  public TupleLatticeElement<Variable, NullLatticeElement> createEntryValue(
      MethodDeclaration method) {
    TupleLatticeElement<Variable, NullLatticeElement> def = ops.getDefault();
    def.put(getAnalysisContext().getThisVariable(), NullLatticeElement.NOT_NULL);
   
    AnnotationSummary summary = annoDB.getSummaryForMethod(method.resolveBinding());
   
    for (int ndx = 0; ndx < method.parameters().size(); ndx++) {
      SingleVariableDeclaration decl = (SingleVariableDeclaration) method.parameters().get(ndx);
      Variable paramVar = getAnalysisContext().getSourceVariable(decl.resolveBinding());
     
      if (summary.getParameter(ndx, AnnotatedNPEAnalysis.NON_NULL_ANNO) != null) //is this parameter annotated with @Nonnull?
        def.put(paramVar, NullLatticeElement.NOT_NULL);
    }
   
    return def;
  }
View Full Code Here

  @Override
  public TupleLatticeElement<Variable, NullLatticeElement> transfer(
      MethodCallInstruction instr,
      TupleLatticeElement<Variable, NullLatticeElement> value) {
    AnnotationSummary summary = annoDB.getSummaryForMethod(instr.resolveBinding());
   
    for (int ndx = 0; ndx < instr.getArgOperands().size(); ndx++) {
      Variable paramVar = instr.getArgOperands().get(ndx);
     
      if (summary.getParameter(ndx, AnnotatedNPEAnalysis.NON_NULL_ANNO) != null) //is this parameter annotated with @Nonnull?
        value.put(paramVar, NullLatticeElement.NOT_NULL);
    }
   
    if (summary.getReturn(AnnotatedNPEAnalysis.NON_NULL_ANNO) != null)
      value.put(instr.getTarget(), NullLatticeElement.NOT_NULL);
   
    //clearly, the receiver is not null if this method call does actually occur ;)
    value.put(instr.getReceiverOperand(), NullLatticeElement.NOT_NULL);
View Full Code Here

  @Override
  public IResult<TupleLatticeElement<Variable, NullLatticeElement>> transfer(
      MethodCallInstruction instr, List<ILabel> labels,
      TupleLatticeElement<Variable, NullLatticeElement> value) {
    AnnotationSummary summary = annoDB.getSummaryForMethod(instr.resolveBinding());
   
    for (int ndx = 0; ndx < instr.getArgOperands().size(); ndx++) {
      Variable paramVar = instr.getArgOperands().get(ndx);
     
      if (summary.getParameter(ndx, BranchingNPEAnalysis.NON_NULL_ANNO) != null) //is this parameter annotated with @Nonnull?
        value.put(paramVar, NullLatticeElement.NOT_NULL);
    }
   
    if (summary.getReturn(BranchingNPEAnalysis.NON_NULL_ANNO) != null)
      value.put(instr.getTarget(), NullLatticeElement.NOT_NULL);
   
    //clearly, the receiver is not null if this method call does actually occur ;)
    value.put(instr.getReceiverOperand(), NullLatticeElement.NOT_NULL);
View Full Code Here

TOP

Related Classes of edu.cmu.cs.crystal.annotations.AnnotationSummary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.