Create new class in Eclipse

Ever want to create a new class of which content from clip board? Don’t bother to create a new empty class and copy the code. Just click on the package and press Ctrl+V. Bingo!


Another reminder of java reflection

Java reflection is powerful, but there are much more things to watch out.

I went into below error when invoke a method using reflection:

java.lang.IllegalArgumentException: object is not an instance of declaring class

It take me almost one whole day to find out the reason, that is I invoke method on class loaded from different Class loader, although the Class looks like the same.

Tip:

When debugging Java code in eclipse, every variable has a (id=**) at the end. It can be used to determine if tow objects, including Class, are the same one.