Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-338

Unexpected ClassCastException during interpretation of Binding

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.0.9, 4.0.0-BETA4
    • 3.0.8, 4.0.0-BETA3
    • None
    • None
    • Workaround Exists
    • Hide

      I'm confident we could work around this by avoiding dodgy downcasts in our tests.

      Show
      I'm confident we could work around this by avoiding dodgy downcasts in our tests.

    Description

      A test we have in the Hibernate Search code base which worked fine with Byteman 3.x seems to highlight a regression in Byteman 4.0.0-BETA3.

      The rule definition:

      @BMRule(
         name = "trackCriteriaEntityType",
         targetClass = "org.hibernate.search.query.hibernate.impl.CriteriaObjectInitializer",
         targetMethod = "buildUpCriteria(java.util.List, org.hibernate.search.query.hibernate.impl.ObjectInitializationContext)",
         targetLocation = "EXIT",
         helper = "org.hibernate.search.testsupport.BytemanHelper",
         binding = "c : org.hibernate.internal.CriteriaImpl = $!.get(0);",
         action = "pushEvent(c.getEntityOrClassName())"
      )
      

      The targeted method declares a return of type List<Criteria>, where Criteria is an interface. This interface is implemented by org.hibernate.internal.CriteriaImpl, and we happen to know that when the rule is invoked the list contains an instance of such CriteriaImpl.

      I'm attaching the generated .class of our Helper and the output of javap -c -p -v run on it.

      This can be easily reproduced as building our project requires no other configuration than having Java8 and Maven.
      sources at:

      Rebuilding will show that the test org.hibernate.search.test.query.initandlookup.CriteriaObjectInitializerAndHierarchyInheritanceTest starts to fail. (Still valid on commit id e54ad8a , N.B. I'll probably workaround this soon).

      Attachments

        Activity

          People

            rhn-engineering-adinn Andrew Dinn
            sgrinove Sanne Grinovero
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: