users@jaxb.java.net

compilation problem with JAXB2 generated code - import statements

From: Vallamshettla, Anand <Anand.Vallamshettla_at_tgslc.org>
Date: Fri, 12 May 2006 14:22:49 -0500

When I compile the following Jaxb 2.0 generated class in IDE such as
Eclipse, it compiles properly; but, when I compile using Ant or javac,
it fails. (NOTE: all the tools are using same Jdk).

 

 

package pack.FFEL;

            

.......

import pack.FFEL.PersonResponseType.Birth;

import pack.FFEL.PersonResponseType.FinancialData;

import pack.FFEL.PersonResponseType.FinancialData.Response;

import pack.core.BirthType;

import pack.core.IndexType;

import pack.core.PersonFinancialDataType;

import pack.core.PersonIdentifiersType;

import pack.core.ResponseType;

 

public class PersonResponseType {

 

    protected Birth birth;

    protected FinancialData financialData;

 

 

    public static class Birth

        extends BirthType

    {

    }

 

 

    public static class FinancialData

        extends PersonFinancialDataType

    {

        protected Response response;

 

        public static class Response

            extends ResponseType

        {

            

        }

    }

 

}

 

Error:

 

    [javac] PersonResponseType.java:33: cannot find symbol

    [javac] symbol : class PersonFinancialDataType

    [javac] location: class pack.FFEL.PersonResponseType

    [javac] extends PersonFinancialDataType

                                   ^

 

Summary:

---------------

Generated class contains import statements in the following order

1) inner classes

2) super classes that these inner classes extend.

 

This class compiles if I do any of the following.

1) I moved "PersonFinancialDataType" import statement to the top
i.e just above inner class imports.

2) Add full package name to "PersonFinancialDataType" at the
'extends' statement, it compiles.

3) Remove import statements for inner classes.

 

Questions:

---------------

1) Why compilation is failing on javac not in IDE.

2) Why can't compiler find 'PersonFinancialDataType' - it is
already in import statement.

3) Are there any circular dependencies etc? If so, why doesn't if
fail on "BirthType", which is similar to 'PersonFinancialDataType' - I
tried changing import/class definition order to get error on
"BirthType"; but never got an error on it.

4) Is there a way to customize JAXB to produce import statements
in proper order or generate full package names.

 

I appreciate if some one could point me to some documentation etc.

 

 

Thanks,

Anand Vallamshettla