1700453450
/**
1700453451
1700453452
*Note:it is important that the APR_STATUS_IS_EBUSY(s)
1700453453
1700453454
*macro be used to determine
1700453455
1700453456
*if the return value was APR_EBUSY, for portability reasons.
1700453457
1700453458
*@param mutex the mutex on which to attempt the lock acquiring.
1700453459
1700453460
*/
1700453461
1700453462
public static native int trylock(long mutex);
1700453463
1700453464
}
1700453465
1700453466
(4)TODO注释
1700453467
1700453468
对于一些未完成的任务,则增加上TODO提示,并标明是什么事情没有做完,以方便下次看到这个TODO标记时还能记忆起要做什么事情,比如在DBCP源代码中有这样的TODO注释:
1700453469
1700453470
public class DelegatingStatement extends……implements……{
1700453471
1700453472
/*
1700453473
1700453474
*Note was protected prior to JDBC 4
1700453475
1700453476
*TODO Consider adding build fags to make this protected
1700453477
1700453478
*unless we are using JDBC 4.
1700453479
1700453480
*/
1700453481
1700453482
public boolean isClosed()throws SQLException{
1700453483
1700453484
return_closed;
1700453485
1700453486
}
1700453487
1700453488
}
1700453489
1700453490
注释只是代码阅读的辅助信息,如果代码的表达能力足够清晰,根本就不需要注释,注释能够帮助我们更好地理解代码,但它所重视的是质量而不是数量。如果一段代码写得很糟糕,即使注解写得再漂亮,也不能解决腐烂代码带来的种种问题,记住,注释不是美化剂,不能美化你的代码,它只是一副催化剂,可以让优秀的代码更加优秀,让拙劣的代码更加腐朽。
1700453491
1700453492
注意 注释不是美化剂,而是催化剂,或为优秀加分,或为拙劣减分。
1700453493
1700453494
1700453495
1700453496
1700453498
编写高质量代码:改善Java程序的151个建议 建议147:让接口的职责保持单一
1700453499
[
上一页 ]
[ :1.70045345e+09 ]
[
下一页 ]