Class BridgeMethodResolver


  • class BridgeMethodResolver
    extends java.lang.Object
    Uses bytecode reflection to figure out the targets of all bridge methods that use invokespecial and invokeinterface, so that we can later rewrite them to use invokevirtual.

    For interface bridges, using invokesuper will fail since the method being bridged to is in a superinterface, not a superclass. Starting in Java 8, javac emits default bridge methods in interfaces, which use invokeinterface to bridge to the target method.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.ClassLoader classLoader  
      private java.util.Map declToBridge  
    • Constructor Summary

      Constructors 
      Constructor Description
      BridgeMethodResolver​(java.util.Map declToBridge, java.lang.ClassLoader classLoader)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map resolveAll()
      Finds all bridge methods that are being called with invokespecial & returns them.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • declToBridge

        private final java.util.Map declToBridge
      • classLoader

        private final java.lang.ClassLoader classLoader
    • Constructor Detail

      • BridgeMethodResolver

        public BridgeMethodResolver​(java.util.Map declToBridge,
                                    java.lang.ClassLoader classLoader)
    • Method Detail

      • resolveAll

        public java.util.Map resolveAll()
        Finds all bridge methods that are being called with invokespecial & returns them.