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

Visibility bridge methods cannot be added for final methods

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 8u51, 9
    • Fix Version/s: tbd_major
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_8

      Description

      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.

        Attachments

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

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated: