Difference between @TypeChecked and @CompileStatic

后端 未结 2 1067
甜味超标
甜味超标 2020-12-14 15:19

Can someone explain the difference between @TypeChecked and @CompileStatic?

I read that with @TypeChecked it is not possible to add new methods at runtime. What oth

2条回答
  •  醉话见心
    2020-12-14 15:43

    tl/dr;

    • @TypeChecked just checks types during compiling, but compiled code behaves same as without @TypeChecked
    • @CompileStatic checks similar to @TypeChecked, but also modifies the code to be type-safe at runtime, meaning methods using dynamic programming will break.

提交回复
热议问题