首页 > 编程知识 正文

java注解的使用,java中使用注解进行类型转换

时间:2023-05-04 21:12:26 阅读:58958 作者:3495

isawsomethodinjavadeclaredas :

voidfoo(@nullableobjectobj ) )。

{ . }

what ' sthemeaningof @ nullable here? does it mean the输入could be null?

Without the annotation,the input can still be null,so I guess that's not just it?

itmakesitclearthatthemethodacceptsnullvalues,and that if you override the method,you should also accept null values。

italsoservesasahintforcodeanalyzerslikefindbugs.for example,ifsuchamethoddereferencesitsargumentwithoutcheckingfornulllfirst

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。