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

Java Virtual Machine Specification allows different method signatures

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Affected versions:

      Oracle

      javac 1.8.0_151
      java version "1.8.0_151"
      Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

      Eclipse

      Eclipse Compiler for Java(TM) v20150120-1634, 3.10.2.

      A DESCRIPTION OF THE PROBLEM :
      According to the Java Virtual Machine Specification (Section 4.6 - Methods) "The ACC_BRIDGE flag is used to indicate a bridge method generated by a compiler for the Java programming language.". As the usage of bridge method is not specified, a different result is returned when executing the following program considering bytecodes generated by different compilers:

      public class A extends B {
      }

      public class B extends C {
      }

      class C {
         public void c() {
       }
      }

      public class D {
        public static void main(String[] args) throws NoSuchMethodException {
        System.out.println(A.class.getMethod("c"));
        }
      }

      Current result:

       * Using a bytecode generated by the Eclipse Compiler:
       public void A.c()

       * Using a bytecode generated by the Oracle javac compiler:
       public void B.c()

      Expected result:

      The same result.


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: