You coded in Java. What is fearest thing you think in programming Java? NullPointerException (NPE)? I think so and it's also the one I fear to face. Ofcourse you can avoid it if you can take care it very very very careful. But what happen if you're season programmer in Java, even you're experience Java programmer?
The best way is finding the way to avoid it. SADNESS, NO WAY! But if you cannot avoid it, you need to learn how to live with it (and ofcourse, improve your knowledge and experience to avoid it later). How can you do it? JetBrains introduced a way to help you can take care NPE a bit more, they're @Nullable and @NotNull annotations. With them, you can avoid NPE by warning to take care NPE more carefully.
You can found out more about @Nullable and @NotNull here and here.
IDEA supported it. Eclipse will support it in version 3.2. It submitted to Sun from JDK version 1.4.2 but still pending. Why doesn't Sun implement it?
One thing I wonder, why is @NotNull? Why is not @NotNullable? Too long? ;-) I think it's better when you see @Nullable and @NotNullable.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment