JiBX
  1. JiBX
  2. JIBX-66

item-type as the parameter type of the add-method in collection does not work for complex types

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-beta3c
    • Fix Version/s: 1.0-RC1
    • Component/s: core
    • Labels:
      None
    • Number of attachments :
      2

      Description

      The current implementation only allows java.lang.Object as the parameter type for the method specified in the attribute add-method of the element collection.

      Instead, it should use the class specified in the attribute item-type (if this attribute is not specified it should use java.lang.Object).

        Activity

        Hide
        Brian Stansberry added a comment -

        This is really a continuation of JIRA-48.

        Sorry - couldn't reopen that one and tried the Jira clone function, which created this report but won't let me edit the "Affects version" or description field.

        This affects 1.0-RC0.

        I find that I still get errors of the type reported in JIBX-48 if the item-type specified for the collection is itself a mapped class. It works fine if collection elements are simple strings, but when I use a mapped type it fails with the following:

        Exception in thread "main" java.lang.IllegalStateException: Internal error: Expected com.wrapsidy.jibx.CollectionElement on stack, found java.lang.Object
        full stack:
        0: com.wrapsidy.jibx.TestJiBXCollection
        1: com.wrapsidy.jibx.TestJiBXCollection
        2: java.lang.Object

        at org.jibx.binding.classes.MethodBuilder.verifyCompatible(MethodBuilder.java:409)
        at org.jibx.binding.classes.MethodBuilder.verifyCallStack(MethodBuilder.java:480)
        at org.jibx.binding.classes.MethodBuilder.verifyCallStack(MethodBuilder.java:501)
        at org.jibx.binding.classes.MethodBuilder.appendCall(MethodBuilder.java:808)
        at org.jibx.binding.def.NestedCollection$AddStore.genStoreItem(NestedCollection.java:666)
        at org.jibx.binding.def.NestedCollection.genContentUnmarshal(NestedCollection.java:133)
        at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:153)
        at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:736)
        at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:875)
        at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:272)
        at org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:541)
        at org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:600)
        at org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:578)

        Will attach a zip with a test case.
        at org.jibx.binding.Loader.processBindings(Loader.java:257)
        at org.jibx.binding.Run.main(Run.java:185)

        Show
        Brian Stansberry added a comment - This is really a continuation of JIRA-48. Sorry - couldn't reopen that one and tried the Jira clone function, which created this report but won't let me edit the "Affects version" or description field. This affects 1.0-RC0. I find that I still get errors of the type reported in JIBX-48 if the item-type specified for the collection is itself a mapped class. It works fine if collection elements are simple strings, but when I use a mapped type it fails with the following: Exception in thread "main" java.lang.IllegalStateException: Internal error: Expected com.wrapsidy.jibx.CollectionElement on stack, found java.lang.Object full stack: 0: com.wrapsidy.jibx.TestJiBXCollection 1: com.wrapsidy.jibx.TestJiBXCollection 2: java.lang.Object at org.jibx.binding.classes.MethodBuilder.verifyCompatible(MethodBuilder.java:409) at org.jibx.binding.classes.MethodBuilder.verifyCallStack(MethodBuilder.java:480) at org.jibx.binding.classes.MethodBuilder.verifyCallStack(MethodBuilder.java:501) at org.jibx.binding.classes.MethodBuilder.appendCall(MethodBuilder.java:808) at org.jibx.binding.def.NestedCollection$AddStore.genStoreItem(NestedCollection.java:666) at org.jibx.binding.def.NestedCollection.genContentUnmarshal(NestedCollection.java:133) at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:153) at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:736) at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:875) at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:272) at org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:541) at org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:600) at org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:578) Will attach a zip with a test case. at org.jibx.binding.Loader.processBindings(Loader.java:257) at org.jibx.binding.Run.main(Run.java:185)
        Hide
        Dennis Sosnoski added a comment -

        I believe this issue has been corrected by the changes since RC0, but I'm not able to build the classes in the attachment zip (due to other missing classes), and have no idea what the other attachment represents. Please retry this using the current CVS code or the upcoming RC1 and comment back on this if you still have a problem.

        Show
        Dennis Sosnoski added a comment - I believe this issue has been corrected by the changes since RC0, but I'm not able to build the classes in the attachment zip (due to other missing classes), and have no idea what the other attachment represents. Please retry this using the current CVS code or the upcoming RC1 and comment back on this if you still have a problem.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Brian Stansberry
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: