Originally posted by gaurikay ke:
what are the pros and cons of using java reflection?
The cons are that you're by-passing the strong typing of Java. That may not seem very serious but it is, because type safety is one of the corner stones of java. Generics for example has been added for the sole purpose of increasing type safety. Gosling even labels reflection a sin (in the quote at the beginning of the reflection chapter of The Java Progreamming Language).
I let others talk about the cons. Only remember that if your needs of reflection mount up
you should consider a language with slack typing instead of Java. There are several. Groove even uses the JVM and is compatible with Java code.
[ December 31, 2005: Message edited by: uj johansson ]