zoukankan      html  css  js  c++  java
  • Spring @Nullable

    Spring提供的 编译期(IdeaEclipse编译时检查,需设置开启) Null-safety检查

    • @Nullable:字段可以为空
    • @NonNull:字段不能为空
    • @NonNullApi: 包级别,参数和返回值非null
    • @NonNullFields:包级别,字段默认非空

    package-info.java 放在需检查的包路径下

    /**
     * Provides basic classes for exception handling and version detection,
     * and other core helpers that are not specific to any part of the framework.
     */
    @NonNullApi //所有参数和返回值非null;如有字段需设置可为空,使用@Nullable
    @NonNullFields
    package org.springframework.core; //检查org.springframework.core包下的所有字段
    
    import org.springframework.lang.NonNullApi;
    import org.springframework.lang.NonNullFields;
    
  • 相关阅读:
    golang recover
    golang sort
    golang matrix
    golang encoding/json
    go package的理解
    golang beego cache
    git操作
    阿里云图标使用
    Stylus的使用
    vue-preview的使用
  • 原文地址:https://www.cnblogs.com/itplay/p/12275792.html
Copyright © 2011-2022 走看看