コード例 #1
0
 /** Case 7: unboxing case: casting to a primitive */
 @Override
 public Void visitTypeCast(TypeCastTree node, Void p) {
   if (isPrimitive(node) && !isPrimitive(node.getExpression())) {
     checkForNullability(node.getExpression(), UNBOXING_OF_NULLABLE);
   }
   return super.visitTypeCast(node, p);
 }
コード例 #2
0
 @Override
 public Void visitTypeCast(TypeCastTree tree, AnnotatedTypeMirror type) {
   if (isUnderlyingTypeAValue(type)) {
     AnnotatedTypeMirror castedAnnotation = getAnnotatedType(tree.getExpression());
     List<?> values = getValues(castedAnnotation, type.getUnderlyingType());
     type.replaceAnnotation(resultAnnotationHandler(type.getUnderlyingType(), values, tree));
   } else if (type.getKind() == TypeKind.ARRAY) {
     if (tree.getExpression().getKind() == Kind.NULL_LITERAL) {
       type.replaceAnnotation(BOTTOMVAL);
     }
   }
   return null;
 }
コード例 #3
0
    @Override
    public Void visitTypeCast(TypeCastTree node, AnnotatedTypeMirror p) {

      if (!p.isAnnotated()) {
        // check if it is casting "this"
        if (TreeUtils.skipParens(node.getExpression()).toString().equals("this")) {
          annotateThis(p);
        }
      }

      return super.visitTypeCast(node, p);
    }