質問

I'm writing small java networking programs for school; obviously RTFM is de rigueur, but in developing skeleton code is it efficient (it's obviously lazy) to just run it by the compiler to see if I've forgotten some checked exception (rather than: RTM-> manually check ...)?

役に立ちましたか?

解決

One "Hack" I have done is make a script to periodically compile my c++ source file everytime I save it. Then script autoclears the terminal window and the top errors are visible. The window is also set as "always ontop". This catches semicolons and other trivial errors/typos very quickly and I can fix immediately.

I don't see why not do something similar in Java or any other language. I don't see this as lazy, it takes some effort to do, and it seams like a good tool for more than finding out if you are missing checked exceptions. You can even write a parser to be analyse the errors for you and give you copy & paste code to potentially fix some of the errors, like the checked exceptions.

For Java, eclipse does a really good job on the checked exception side, it even pre-inserts the exceptions for you when you press CTRL+1. When using eclipse I haven't had the need to do something similar as I did in c++ because eclipse does a good job parsing Java sources and putting a marker on errors such as typos and other things even before you save the file.

他のヒント

Yes - the compiler is an essential tool in developing anything that is more than 5 lines long. An IDE such as IntelliJ will compile real time as you type immediately highlighting errors.

enter image description here

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top