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

BadSerializationTest and DragGestureEvent/DragGestureRecognizer constructors

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 17
    • client-libs
    • None

      Currently java/awt/dnd/BadSerializationTest tests invalid serialized DragGestureEvent/DragGestureRecognizer instances by relying on checked in serialized data. The serialized data has to be generated by manually patching the constructors of DragGestureEvent/DragGestureRecognizer to disable validation, and then generating and checking in the serialized data.

      See also the implementation comment here: https://github.com/openjdk/jdk/blob/fef8f2d30004ea75c663752ae6c61b214fb8abc8/test/jdk/java/awt/dnd/BadSerializationTest/BadSerializationTest.java#L95-L96

      As suggested in https://git.openjdk.java.net/jdk/pull/6603#issuecomment-997054470, it is possible to generated the serialized data by using reflection to create the invalid DragGestureEvent/DragGestureRecognizer, instead of relying on patching their constructors.

      Using reflection makes regenerating the test data more repeatable (since it doesn't rely on recreating a the patch to disable constructor validation and building a patched JDK), and could enable generating the serialized data when the test executes instead of relying on checking it in (see discussion in https://git.openjdk.java.net/jdk/pull/6603).

            Unassigned Unassigned
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: