concept reflection in category java

This is an excerpt from Manning's book The Java Module System.
Replacing reflection with variable handles (see section 12.3.2)
Figure 1.10 The maintainers of Eclipse JGit didn’t intend the types in
org.eclipse.jgit.internalfor public consumption. Unfortunately, because Java has no concept of JAR internals, there’s nothing the maintainers can do to stop anycom.company.Typefrom compiling against it. Even if it were only package visible, it could still be accessed via reflection.![]()
If you’re working on a Java application, chances are good that you rely on Spring, Hibernate, JAXP, GSON, or the like. What are “the like”? Frameworks that use Java’s reflection API to inspect your code, search for annotations, instantiate objects, or call methods. Thanks to reflection, they can do all that without having to compile against your code.
Moreover, the reflection API allows frameworks to access nonpublic classes and nonpublic members. It has superpowers beyond what’s possible with compiled code, which bounces off of package boundaries if classes or members aren’t public. The thing is that with modules, reflection no longer works out of the box.
Quite the opposite: reflection lost its superpowers and is bound to the exact same accessibility rules as compiled code. It can only access public members of public classes in exported packages. These frameworks, on the other hand, use reflection over fields and methods that often aren’t public and on classes that you may not want to export because they aren’t part of a module’s API. What do you do then? That’s what this chapter is all about!

This is an excerpt from Manning's book JUnit in Action, Second Edition.
Bypassing encapsulation through reflection
When fields of tested objects are private, most likely they will be accessed through reflection later on by some framework class. So, instead of complaining about privacy concerns, why don’t you play by the same rules and use reflection to access these fields in the test cases?
For instance, the UserFacadeImpl object defined in listing 19.4 has a private reference to a UserDao, and so far this reference could be set only through a public setUserDao() method. But if that method isn’t available, we could use reflection to access it instead. In this section we show how to do so, first using an in-house utility class and then analyzing two tools that provide such features for free.

This is an excerpt from Manning's book AspectJ in Action, Second Edition.
Scala is a new language that compiles source code to the standard Java byte code. Scala maps program elements to byte code in a manner similar to that of Java. This lets you use Scala with AspectJ. You can see a working example at http://blog.objectmentor.com/articles/2008/09/27/traits-vs-aspects-in-scala. Note that, unlike Scala, other JVM languages such as JRuby and Groovy use mapping that heavily relies on reflection. Therefore, AspectJ may not be used as readily with those. Instead, you need specialized languages that work with them, as you’ll see in section 1.6.3.
Note that annotations accessed during runtime must be marked with a runtime retention policy using the @Retention(RetentionPolicy.RUNTIME) meta-annotation. This requirement is common to any runtime usages of annotations (such as through reflection) and not specific to AspectJ.