Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8133168

Visibility bridge methods cannot be added for final methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 8u51, 9
    • tools
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_51"
      Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      A DESCRIPTION OF THE PROBLEM :
      javac adds visibility bridges to work around limitations of the reflection system when inheriting public methods of non-public types.

      This does not work for final methods: https://gist.github.com/raphw/7d10ae082ace5886d601

      REGRESSION. Last worked in version 8u51

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_51"
      Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      https://gist.github.com/raphw/7d10ae082ace5886d601

      Compile and run to reproduce error.

      EXPECTED VERSUS ACTUAL BEHAVIOUR :
      EXPECTED -
      Should not throw an exception for final methods.
      ACTUAL -
      Throws an exception

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      IllegalAccessException

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      https://gist.github.com/raphw/7d10ae082ace5886d601
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No work around possible due to final method.

        1. VisibilityBridgeTest.java
          0.3 kB
        2. VisibilityBridgeTest.java
          0.6 kB
        3. Foo.java
          0.1 kB
        4. Foo.java
          0.2 kB

            mcimadamore Maurizio Cimadamore
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: