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

(ann) Binary compat - unexpected ClassCastException when changing type of member

XMLWordPrintable

    • b51
    • generic
    • generic

      In Section VIII Annotation Type Evolution (Binary Compatibility)
      Changing the Type of an Annotation Type Member

      It is mentioned that:-

      1) Attempting to read the annotation type using the revised interface will result in an AnnotationTypeMismatchException

      2) Class files that invoke the accessor will fail at runtime with a NoSuchMethodError.

      Not sure like if one can not read the annotation using the revised interface how come one can invoke the accessor leading to NoSuchMethodError.

      In the attached test case:-
      Reading the annotation using the revised interface is happening without AnnotationTypeMismatchException secondly while invoking the accessor ClassCastException is thrown instead of NoSuchMethodError

      It is happening with Tiger-beta2 build 41
      Tried on Solaris-9, not tried on other platforms.

      How to reproduce:-
      Untar the attached BinaryIncompatibilityTest6.tar
      cd BinaryIncompatibilityTest6/Helper directory
      compile the source files
      execute SerializeAnnotation it will generate AnnotationTest file
      copy A.class and AnnotationTest to BinaryIncompatibilityTest6 directory
      cd to BinaryIncompatibilityTest6
      compile the source files javac *.java
      execute BinaryIncompatibilityTest6 file

      In the output one can see the ClassCastException

            gafter Neal Gafter (Inactive)
            jsinghsunw Jit Singh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: