[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jibx-devs
Subject:    [jibx-devs] [jira] Created: (JIBX-156) binding compiler is not
From:       "pierre.kobylanski (JIRA)" <jira () codehaus ! org>
Date:       2007-02-22 8:38:27
Message-ID: 65754194.1172133507051.JavaMail.haus-jira () codehaus01 ! managed ! contegix ! com
[Download RAW message or body]

binding compiler is not aware of inherited interfaces
-----------------------------------------------------

                 Key: JIBX-156
                 URL: http://jira.codehaus.org/browse/JIBX-156
             Project: JiBX
          Issue Type: Bug
          Components: core
    Affects Versions: JiBX 1.1.3
         Environment: win xp / java 1.4.2_08 / jibx 1.1.3 (December 18, 2006)
            Reporter: pierre.kobylanski
         Attachments: bug.zip

Here is a short exmple (see attachment for full code):

==========================
public interface Bug_Itf 
 { }

public abstract class Bug_Abstract implements Bug_Itf
 { }

public class Bug_Impl extends Bug_Abstract
  // implements Bug_Itf                       // ==> if not explicitly mentioned, \
JiBX is not aware of this relationship  { }

public class Bug_Test {
  private Bug_Itf m_impl;                    // ==> Note: If m_impl is of type \
Bug_Impl or Bug_Abstract, the pb doesn't appear

  public static void main (String[] args) throws Exception {
    Bug_Test t = new Bug_Test();
    IBindingFactory bfact = BindingDirectory.getFactory(Bug_Test.class);
    IMarshallingContext mctx = bfact.createMarshallingContext();
    mctx.marshalDocument(t, "UTF-8", null, System.out);
  }
}
==========================

when applying the binding (see it below),
     javac -classpath '.;jibx-run.jar' *.java
     java -jar jibx-bind.jar Bug_binding.xml
I get the error
  Error: No compatible mapping defined for type Bug_Itf; on structure element at \
(line 20, col 50, in Bug_binding.xml)  Error running binding compiler
  org.jibx.runtime.JiBXException: Binding Bug_binding.xml is unusable because of \
validation errors  at org.jibx.binding.Utility.loadBinding(Utility.java:346)
          at org.jibx.binding.Utility.loadFileBinding(Utility.java:413)
          at org.jibx.binding.Compile.compile(Compile.java:296)
          at org.jibx.binding.Compile.main(Compile.java:385)


Mentioning explicitly the Bug_Impl implements Bug_Itf resolves the pb.


Bug_binding.xml:
=============================
<?xml version='1.0' encoding='UTF-8' ?>

<binding>

  <!-- abstract mapping for
       Bug_Abstract (implements interface Bug_Itf)  -->
  <mapping class="Bug_Abstract" abstract="true" type-name="A_abstract" />

  <!-- abstract and concrete mappings for
       Bug_Impl (extends abstract class Bug_Itf)  -->
  <mapping class="Bug_Impl" abstract="true" type-name="A_impl">
    <structure map-as="A_abstract" />
  </mapping>
  <mapping name="impl" class="Bug_Impl">
    <structure map-as="A_impl" />
  </mapping>

  <!-- the test class, contains a "private Bug_Itf m_impl" -->
  <mapping class="Bug_Test" abstract="true" type-name="A_test">
    <structure field="m_impl" usage="optional" />
  </mapping>
  <mapping name="test" class="Bug_Test">
    <structure map-as="A_test" />
  </mapping>

</binding>
=============================


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: \
                http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic