Choose the contract supported by each Java runtime operation.
Read the lessons
- Java reflection: separate an invoked method failure from lookup failure
- Java getMethod: resolve an overload by its exact parameter types
- Java trySetAccessible: handle a denied deep-reflection request
- Java dynamic proxies: define Object-method behavior explicitly
- Java ServiceLoader: treat provider discovery as fallible startup work
- Java Class.forName: inspect an allowlisted class without initializing it
- Java modules: distinguish exported APIs from open packages
- Java MethodHandle.invokeExact: make the call-site type part of the contract
Common Mistakes
Do not treat reflective access or provider packaging as implicit.
