You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by pc...@apache.org on 2004/05/13 01:14:18 UTC

cvs commit: xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam JamTestBase.java SourcesJamTest.java

pcal        2004/05/12 16:14:18

  Modified:    v2/jam/src/org/apache/xmlbeans/impl/jam JClass.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements
                        ClassImpl.java ElementImpl.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/internal/java15
                        Javadoc15DelegateImpl.java
                        Reflect15DelegateImpl.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc
                        JavadocClassBuilder.java JavadocResults.java
               v2/jam/test build.xml
               v2/jam/test/dummyclasses/org/apache/xmlbeans/test/jam/dummyclasses
                        ImportsGalore.java
               v2/jam/test/masters/javadoc testXmlWriter.xml
               v2/jam/test/tests/org/apache/xmlbeans/test/jam
                        JamTestBase.java SourcesJamTest.java
  Log:
  jam: fix JClass package and class imports, some cleanup work in anticipation of coming 1.5 drops
  
  Revision  Changes    Path
  1.7       +18 -14    xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JClass.java
  
  Index: JClass.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JClass.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JClass.java	2 Apr 2004 02:41:06 -0000	1.6
  +++ JClass.java	12 May 2004 23:14:18 -0000	1.7
  @@ -342,26 +342,30 @@
     public JClass forName(String name);
   
     /**
  -   * Returns the minmal set of JPackages which contain all of the clases
  -   * imported by this class.  This includes packages imported via the '*'
  -   * import notation as well as the packages which contain explicitly
  -   * imported classes.
  +   * <p>Returns a list of classes that were explicitly imported by this
  +   * class using an import statement.  It does not include any classes
  +   * that might be imported via package imports (i.e. with the '*' wildcard),
  +   * nor does it include any classes that are simply used via fully-qualified
  +   * name in the body of this class.</p>
      *
  -   * Note that this is an optional operation; if the source for the
  -   * class is not available (i.e. this JClass is backed by a
  -   * java.lang.Class), then this method will return an array of length
  -   * 0.
  +   * <p>Note that this is an optional operation; if the source for the class
  +   * is not available (i.e. this JClass is backed by a java.lang.Class), then
  +   * this method will return an array of length 0.</p>
      */
  -  public JPackage[] getImportedPackages();
  +  public JClass[] getImportedClasses();
   
     /**
  -   * Returns a list of classes that were explicitly imported by this
  -   * class.  Note that this is an optional operation; if the source
  -   * for the class is not available (i.e. this JClass is backed by a
  +   * <p>Returns the set of JPackages which are imported by this class using
  +   * a package import statement (i.e. with the '*' wildcard), as well as the
  +   * containing packages of all of the JClasses returned by <code>
  +   * getImportedClasses()</code>.</p>
  +   *
  +   * <p>Note that this is an optional operation; if the source for the
  +   * class is not available (i.e. this JClass is backed by a
      * java.lang.Class), then this method will return an array of length
  -   * 0.
  +   * 0.</p>
      */
  -  public JClass[] getImportedClasses();
  +  public JPackage[] getImportedPackages();
   
     /**
      * Returns true if a backing entity for this class could not be
  
  
  
  1.15      +20 -2     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/ClassImpl.java
  
  Index: ClassImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/ClassImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ClassImpl.java	11 May 2004 15:59:07 -0000	1.14
  +++ ClassImpl.java	12 May 2004 23:14:18 -0000	1.15
  @@ -30,6 +30,9 @@
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.List;
  +import java.util.HashSet;
  +import java.util.Set;
  +import java.util.TreeSet;
   
   /**
    * <p>Implementation of JClass and MClass.</p>
  @@ -233,12 +236,27 @@
   
     public JPackage[] getImportedPackages() {
       ensureLoaded();
  -    return new JPackage[0];//FIXME
  +    Set set = new TreeSet();
  +    JClass[] importedClasses = getImportedClasses();
  +    for(int i=0; i<importedClasses.length; i++) {
  +      set.add(importedClasses[i].getContainingPackage());
  +    }
  +    String[] imports = getImportSpecs();
  +    if (imports != null) {
  +      for(int i=0; i<imports.length; i++) {
  +        if (imports[i].endsWith(".*")) {
  +          set.add(getClassLoader().
  +                  getPackage(imports[i].substring(0,imports[i].length()-2)));
  +        }
  +      }
  +    }
  +    JPackage[] array = new JPackage[set.size()];
  +    set.toArray(array);
  +    return array;
     }
   
     public JClass[] getImportedClasses() {
       ensureLoaded();
  -//    if (true) throw new IllegalStateException();
       String[] imports = getImportSpecs();
       if (imports == null) return new JClass[0];
       List list = new ArrayList();
  
  
  
  1.8       +11 -1     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/ElementImpl.java
  
  Index: ElementImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/ElementImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ElementImpl.java	26 Mar 2004 00:15:39 -0000	1.7
  +++ ElementImpl.java	12 May 2004 23:14:18 -0000	1.8
  @@ -27,7 +27,7 @@
    *
    * @author Patrick Calahan &lt;email: pcal-at-bea-dot-com&gt;
    */
  -public abstract class ElementImpl implements MElement {
  +public abstract class ElementImpl implements Comparable, MElement {
   
     // ========================================================================
     // Constants
  @@ -155,5 +155,15 @@
   
     protected JamLogger getLogger() {
       return ((JamServiceContextImpl)mContext).getLogger();
  +  }
  +
  +  // ========================================================================
  +  // Comparable implementation
  +
  +  public int compareTo(Object o) {
  +    if (!(o instanceof JElement)) {
  +      return -1;
  +    }
  +    return getQualifiedName().compareTo(((JElement)o).getQualifiedName());
     }
   }
  
  
  
  1.5       +10 -4     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/java15/Javadoc15DelegateImpl.java
  
  Index: Javadoc15DelegateImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/java15/Javadoc15DelegateImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Javadoc15DelegateImpl.java	8 Apr 2004 19:44:44 -0000	1.4
  +++ Javadoc15DelegateImpl.java	12 May 2004 23:14:18 -0000	1.5
  @@ -16,8 +16,6 @@
   
   import org.apache.xmlbeans.impl.jam.mutable.MAnnotatedElement;
   import org.apache.xmlbeans.impl.jam.mutable.MAnnotation;
  -import org.apache.xmlbeans.impl.jam.mutable.MSourcePosition;
  -import org.apache.xmlbeans.impl.jam.mutable.MElement;
   import org.apache.xmlbeans.impl.jam.internal.javadoc.Javadoc15Delegate;
   import org.apache.xmlbeans.impl.jam.internal.javadoc.JavadocClassBuilder;
   import org.apache.xmlbeans.impl.jam.internal.elements.ElementContext;
  @@ -29,8 +27,11 @@
   import com.sun.javadoc.AnnotationValue;
   import com.sun.javadoc.FieldDoc;
   import com.sun.javadoc.ClassDoc;
  -import com.sun.javadoc.AnnotationTypeMemberDoc;
   import com.sun.javadoc.SourcePosition;
  +// import com.sun.javadoc.AnnotationTypeElementDoc;
  +import com.sun.javadoc.AnnotationTypeMemberDoc;
  +
  +
   
   /**
    * @author Patrick Calahan &lt;email: pcal-at-bea-dot-com&gt;
  @@ -90,10 +91,13 @@
                                     AnnotationDesc src, 
                                     SourcePosition sp) {
       if (sp != null) JavadocClassBuilder.addSourcePosition(dest,sp);
  +//    AnnotationDesc.ElementValuePair[] mvps = src.elementValues();
       AnnotationDesc.MemberValuePair[] mvps = src.memberValues();
       for(int i=0; i<mvps.length; i++) {
  +//      Type jmt = mvps[i].element().returnType();
         Type jmt = mvps[i].member().returnType();
         String typeName = jmt.qualifiedTypeName();
  +//      String name = mvps[i].element().name();
         String name = mvps[i].member().name();
         AnnotationValue aval = mvps[i].value();
         Object valueObj;
  @@ -141,6 +145,7 @@
         } else if (valueObj instanceof AnnotationValue[]) {
           // this is another big chunk of work, just factored into a new
           // method to keep things cleaner
  +//        populateArrayMember(dest,mvps[i].element(),(AnnotationValue[])valueObj,sp);
           populateArrayMember(dest,mvps[i].member(),(AnnotationValue[])valueObj,sp);
         } else {
           mContext.getLogger().error("Value of annotation member "+name+" is " +
  @@ -170,7 +175,7 @@
      *
      * <p>It seems quite broken to me that in the array case, it returns an array
      * of AnnotationValues.  It would be a lot easier to deal with the API
  -   * if that last line instead read "or an array of any of the above."
  +   * if that last line instead read "or an array of any of the above."                                           
      * As it is, it's imposible to get the doclet API to give you a simple
      * array of ints, for example.  It's not at all clear what the extra
      * wrapping buys you.</p>
  @@ -179,6 +184,7 @@
      * for the user.</p>
      */
     private void populateArrayMember(MAnnotation dest,
  +//                                   AnnotationTypeElementDoc memberDoc,
                                      AnnotationTypeMemberDoc memberDoc,
                                      AnnotationValue[] annValueArray,
                                      SourcePosition sp)
  
  
  
  1.5       +1 -1      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/java15/Reflect15DelegateImpl.java
  
  Index: Reflect15DelegateImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/java15/Reflect15DelegateImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Reflect15DelegateImpl.java	7 Apr 2004 04:18:09 -0000	1.4
  +++ Reflect15DelegateImpl.java	12 May 2004 23:14:18 -0000	1.5
  @@ -168,7 +168,7 @@
         }
         try {
           if (isVerbose) mLogger.verbose("invoking "+methods[i].getName()+"()");
  -        Object value = methods[i].invoke(src,null);
  +        Object value = methods[i].invoke(src,(Object[])null);
           if (isVerbose) mLogger.verbose("value is "+value);
           if (value instanceof Annotation) {
             if (isVerbose) mLogger.verbose("it's nested!!  creating for "+
  
  
  
  1.23      +20 -4     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc/JavadocClassBuilder.java
  
  Index: JavadocClassBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc/JavadocClassBuilder.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- JavadocClassBuilder.java	11 May 2004 15:59:07 -0000	1.22
  +++ JavadocClassBuilder.java	12 May 2004 23:14:18 -0000	1.23
  @@ -26,6 +26,8 @@
   
   import java.io.*;
   import java.util.StringTokenizer;
  +import java.util.List;
  +import java.util.ArrayList;
   
   /**
    * @author Patrick Calahan &lt;email: pcal-at-bea-dot-com&gt;
  @@ -176,17 +178,31 @@
         }
         return null;
       }
  -    String[] importSpecs = null;
  +    List importSpecs = null;
       {
         ClassDoc[] imported = cd.importedClasses();
         if (imported != null) {
  -        importSpecs = new String[imported.length];
  +        importSpecs = new ArrayList();
           for(int i=0; i<imported.length; i++) {
  -          importSpecs[i] = imported[i].qualifiedName();
  +          importSpecs.add(imported[i].qualifiedName());
           }
         }
       }
  -    MClass out = createClassToBuild(packageName, className, importSpecs, this);
  +    {
  +      PackageDoc[] imported = cd.importedPackages();
  +      if (imported != null) {
  +        if (importSpecs == null) importSpecs = new ArrayList();
  +        for(int i=0; i<imported.length; i++) {
  +          importSpecs.add(imported[i].name()+".*");
  +        }
  +      }
  +    }
  +    String[] importSpecsArray = null;
  +    if (importSpecs != null) {
  +      importSpecsArray = new String[importSpecs.size()];
  +      importSpecs.toArray(importSpecsArray);
  +    }
  +    MClass out = createClassToBuild(packageName, className, importSpecsArray, this);
       out.setArtifact(cd);
       return out;
     }
  
  
  
  1.4       +1 -1      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc/JavadocResults.java
  
  Index: JavadocResults.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc/JavadocResults.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JavadocResults.java	9 Mar 2004 10:38:53 -0000	1.3
  +++ JavadocResults.java	12 May 2004 23:14:18 -0000	1.4
  @@ -65,7 +65,7 @@
       try {
         Object holder = getHolder();
         Method getter = holder.getClass().getMethod("_getRoot",new Class[0]);
  -      return (RootDoc)getter.invoke(holder,null);
  +      return (RootDoc)getter.invoke(holder,(Object[])null);
       } catch(Exception e) {
         e.printStackTrace();
         throw new IllegalStateException();//FIXME??
  
  
  
  1.12      +5 -1      xml-xmlbeans/v2/jam/test/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/test/build.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- build.xml	10 May 2004 22:54:02 -0000	1.11
  +++ build.xml	12 May 2004 23:14:18 -0000	1.12
  @@ -1,6 +1,10 @@
   <!-- NOTE: if you get errors about not being able to load the junit
  -     task, try copying ../external/lib/junit.jar into your ant/lib 
  +     task, try copying ../external/lib/junit.jar into your ant/lib
        directory.  This seems to be an ant or JDK 1.5 bug, not sure which.
  +
  +     ALSO: If you are building under JDK1.5, you now MUST build under
  +     1.5 beta49 or later.  This is becuase in b49 Sun renamed some classes
  +     and methods in the doclet API.
   -->
   
   
  
  
  
  1.2       +1 -0      xml-xmlbeans/v2/jam/test/dummyclasses/org/apache/xmlbeans/test/jam/dummyclasses/ImportsGalore.java
  
  Index: ImportsGalore.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/test/dummyclasses/org/apache/xmlbeans/test/jam/dummyclasses/ImportsGalore.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ImportsGalore.java	26 Mar 2004 19:40:25 -0000	1.1
  +++ ImportsGalore.java	12 May 2004 23:14:18 -0000	1.2
  @@ -17,6 +17,7 @@
   import org.apache.xmlbeans.impl.jam.JClass;
   import javax.xml.stream.XMLStreamException;
   import java.util.Properties;
  +import java.lang.reflect.*;
   
   /**
    * @author Patrick Calahan &lt;email: pcal-at-bea-dot-com&gt;
  
  
  
  1.8       +1 -1      xml-xmlbeans/v2/jam/test/masters/javadoc/testXmlWriter.xml
  
  Index: testXmlWriter.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/test/masters/javadoc/testXmlWriter.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- testXmlWriter.xml	11 May 2004 15:59:08 -0000	1.7
  +++ testXmlWriter.xml	12 May 2004 23:14:18 -0000	1.8
  @@ -1,4 +1,4 @@
  -<jam-service><class><name>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.EmployeeGroupAnnotation</name><is-interface>true</is-interface><modifiers>513</modifiers><interface>java.lang.annotation.Annotation</interface><method><name>employees</name><return-type>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.EmployeeAnnotation[]</return-type><modifiers>1</modifiers><source-position><line>26</line><column>24</column></source-position></method><annotation><name>java.lang.annotation.Retention</name><annotation-value><name>value</name><type>java.lang.annotation.RetentionPolicy</type><value>RUNTIME</value></annotation-value></annotation><annotation><name>java.lang.annotation.Target</name><annotation-value><name>value</name><type>java.lang.annotation.ElementType[]</type><value>SORRY, ARRAYS ARE NYI</value></annotation-value></annotation><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>24</line><column>9</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.Foo</name><is-interface>true</is-interface><modifiers>513</modifiers><method><name>getId</name><return-type>int</return-type><modifiers>1</modifiers><source-position><line>12</line><column>14</column></source-position></method><method><name>setId</name><return-type>void</return-type><modifiers>1</modifiers><parameter><name>id</name><type>int</type></parameter><source-position><line>14</line><column>15</column></source-position></method><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>pcal Nov 25, 2003</value></annotation-value></annotation><comment><![CDATA[Dummy class for JAM tests.]]></comment><source-position><line>10</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.ejb.TradeResult</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Object</superclass><constructor><modifiers>1</modifiers><source-position><line>3</line><column>8</column></source-position></constructor><source-position><line>3</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.EmployeeAnnotation</name><is-interface>true</is-interface><modifiers>513</modifiers><interface>java.lang.annotation.Annotation</interface><method><name>firstName</name><return-type>java.lang.String</return-type><modifiers>1</modifiers><source-position><line>26</line><column>12</column></source-position></method><method><name>lastName</name><return-type>java.lang.String</return-type><modifiers>1</modifiers><source-position><line>27</line><column>12</column></source-position></method><method><name>address</name><return-type>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.AddressAnnotation</return-type><modifiers>1</modifiers><source-position><line>28</line><column>23</column></source-position></method><method><name>active</name><return-type>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.Constants.Bool</return-type><modifiers>1</modifiers><source-position><line>29</line><column>20</column></source-position></method><method><name>specialDigits</name><return-type>int[]</return-type><modifiers>1</modifiers><source-position><line>30</line><column>11</column></source-position></method><method><name>aka</name><return-type>java.lang.String[]</return-type><modifiers>1</modifiers><source-position><line>31</line><column>14</column></source-position></method><annotation><name>java.lang.annotation.Retention</name><annotation-value><name>value</name><type>java.lang.annotation.RetentionPolicy</type><value>RUNTIME</value></annotation-value></annotation><annotation><name>java.lang.annotation.Target</name><annotation-value><name>value</name><type>java.lang.annotation.ElementType[]</type><value>SORRY, ARRAYS ARE NYI</value></annotation-value></annotation><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>25</line><column>9</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.ImportsGalore</name><is-interface>true</is-interface><modifiers>513</modifiers><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>24</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.ejb.MyEjbException</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Exception</superclass><constructor><modifiers>1</modifiers><source-position><line>21</line><column>8</column></source-position></constructor><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>21</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.Baz</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Object</superclass><interface>java.lang.Runnable</interface><constructor><modifiers>1</modifiers><source-position><line>9</line><column>8</column></source-position></constructor><method><name>run</name><return-type>void</return-type><modifiers>1</modifiers><source-position><line>11</line><column>15</column></source-position></method><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>pcal Nov 25, 2003</value></annotation-value></annotation><comment><![CDATA[Dummy class for JAM tests.]]></comment><source-position><line>9</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.FooImpl</name><is-interface>false</is-interface><modifiers>1025</modifiers><superclass>org.apache.xmlbeans.test.jam.dummyclasses.Base</superclass><interface>org.apache.xmlbeans.test.jam.dummyclasses.Foo</interface><constructor><modifiers>1</modifiers><source-position><line>12</line><column>17</column></source-position></constructor><method><name>getId</name><return-type>int</return-type><modifiers>1</modifiers><source-position><line>14</line><column>14</column></source-position></method><method><name>setId</name><return-type>void</return-type><modifiers>1</modifiers><parameter><name>id</name><type>int</type></parameter><source-position><line>16</line><column>15</column></source-position></method><method><name>setId2</name><return-type>void</return-type><modifiers>26</modifiers><parameter><name>id</name><type>double</type></parameter><source-position><line>18</line><column>29</column></source-position></method><method><name>setId3</name><return-type>void</return-type><modifiers>36</modifiers><parameter><name>id</name><type>double</type></parameter><parameter><name>id2</name><type>double</type></parameter><source-position><line>20</line><column>31</column></source-position></method><method><name>setId4</name><return-type>void</return-type><modifiers>1028</modifiers><parameter><name>id</name><type>double</type></parameter><parameter><name>id2</name><type>double</type></parameter><parameter><name>id3</name><type>double</type></parameter><source-position><line>22</line><column>27</column></source-position></method><method><name>methodDealingWithArrays</name><return-type>java.lang.String[][]</return-type><modifiers>0</modifiers><parameter><name>foo</name><type>int[]</type></parameter><parameter><name>bar</name><type>java.lang.Object[]</type></parameter><source-position><line>24</line><column>14</column></source-position></method><method><name>iThrowExceptions</name><return-type>void</return-type><modifiers>1028</modifiers><parameter><name>p1</name><type>int</type></parameter><parameter><name>p2</name><type>java.lang.String</type></parameter><source-position><line>28</line><column>27</column></source-position></method><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>pcal Nov 25, 2003</value></annotation-value></annotation><comment><![CDATA[Dummy class for JAM tests.]]></comment><source-position><line>12</line><column>17</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.ManyTags</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Object</superclass><constructor><modifiers>1</modifiers><source-position><line>20</line><column>8</column></source-position></constructor><method><name>getId</name><return-type>int</return-type><modifiers>1</modifiers><annotation><name>foo</name><annotation-value><name>x</name><type>java.lang.String</type><value>-43</value></annotation-value><annotation-value><name>z</name><type>java.lang.String</type><value>79</value></annotation-value><annotation-value><name>y</name><type>java.lang.String</type><value>124</value></annotation-value><annotation-value><name>y</name><type>java.lang.String</type><value>2</value></annotation-value><annotation-value><name>x</name><type>java.lang.String</type><value>1</value></annotation-value><annotation-value><name>z</name><type>java.lang.String</type><value>3</value></annotation-value><annotation-value><name>w</name><type>java.lang.String</type><value>0</value></annotation-value></annotation><annotation><name>baz</name><annotation-value><name>x</name><type>java.lang.String</type><value>1</value></annotation-value></annotation><annotation><name>bar</name><annotation-value><name>x</name><type>java.lang.String</type><value>-4343</value></annotation-value></annotation><source-position><line>33</line><column>14</column></source-position></method><comment><![CDATA[Tests case for javadoc tags is declared more than once in a document.]]></comment><source-position><line>20</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.MyException</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Exception</superclass><constructor><modifiers>1</modifiers><source-position><line>21</line><column>8</column></source-position></constructor><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>21</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.HeavilyCommented</name><is-interface>false</is-interface><modifiers>1025</modifiers><superclass>java.lang.Object</superclass><constructor><modifiers>1</modifiers><source-position><line>21</line><column>17</column></source-position></constructor><method><name>simpleComment</name><return-type>void</return-type><modifiers>1028</modifiers><comment><![CDATA[A simple comment.]]></comment><source-position><line>26</line><column>27</column></source-position></method><method><name>multilineComment</name><return-type>void</return-type><modifiers>1028</modifiers><comment><![CDATA[A comment which
  +<jam-service><class><name>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.EmployeeGroupAnnotation</name><is-interface>true</is-interface><modifiers>513</modifiers><interface>java.lang.annotation.Annotation</interface><method><name>employees</name><return-type>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.EmployeeAnnotation[]</return-type><modifiers>1</modifiers><source-position><line>26</line><column>24</column></source-position></method><annotation><name>java.lang.annotation.Retention</name><annotation-value><name>value</name><type>java.lang.annotation.RetentionPolicy</type><value>RUNTIME</value></annotation-value></annotation><annotation><name>java.lang.annotation.Target</name><annotation-value><name>value</name><type>java.lang.annotation.ElementType[]</type><value>SORRY, ARRAYS ARE NYI</value></annotation-value></annotation><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>24</line><column>9</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.Foo</name><is-interface>true</is-interface><modifiers>513</modifiers><method><name>getId</name><return-type>int</return-type><modifiers>1</modifiers><source-position><line>12</line><column>14</column></source-position></method><method><name>setId</name><return-type>void</return-type><modifiers>1</modifiers><parameter><name>id</name><type>int</type></parameter><source-position><line>14</line><column>15</column></source-position></method><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>pcal Nov 25, 2003</value></annotation-value></annotation><comment><![CDATA[Dummy class for JAM tests.]]></comment><source-position><line>10</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.ejb.TradeResult</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Object</superclass><constructor><modifiers>1</modifiers><source-position><line>3</line><column>8</column></source-position></constructor><source-position><line>3</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.EmployeeAnnotation</name><is-interface>true</is-interface><modifiers>513</modifiers><interface>java.lang.annotation.Annotation</interface><method><name>firstName</name><return-type>java.lang.String</return-type><modifiers>1</modifiers><source-position><line>26</line><column>12</column></source-position></method><method><name>lastName</name><return-type>java.lang.String</return-type><modifiers>1</modifiers><source-position><line>27</line><column>12</column></source-position></method><method><name>address</name><return-type>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.AddressAnnotation</return-type><modifiers>1</modifiers><source-position><line>28</line><column>23</column></source-position></method><method><name>active</name><return-type>org.apache.xmlbeans.test.jam.dummyclasses.jsr175.Constants.Bool</return-type><modifiers>1</modifiers><source-position><line>29</line><column>20</column></source-position></method><method><name>specialDigits</name><return-type>int[]</return-type><modifiers>1</modifiers><source-position><line>30</line><column>11</column></source-position></method><method><name>aka</name><return-type>java.lang.String[]</return-type><modifiers>1</modifiers><source-position><line>31</line><column>14</column></source-position></method><annotation><name>java.lang.annotation.Retention</name><annotation-value><name>value</name><type>java.lang.annotation.RetentionPolicy</type><value>RUNTIME</value></annotation-value></annotation><annotation><name>java.lang.annotation.Target</name><annotation-value><name>value</name><type>java.lang.annotation.ElementType[]</type><value>SORRY, ARRAYS ARE NYI</value></annotation-value></annotation><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>25</line><column>9</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.ImportsGalore</name><is-interface>true</is-interface><modifiers>513</modifiers><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>25</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.ejb.MyEjbException</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Exception</superclass><constructor><modifiers>1</modifiers><source-position><line>21</line><column>8</column></source-position></constructor><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>21</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.Baz</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Object</superclass><interface>java.lang.Runnable</interface><constructor><modifiers>1</modifiers><source-position><line>9</line><column>8</column></source-position></constructor><method><name>run</name><return-type>void</return-type><modifiers>1</modifiers><source-position><line>11</line><column>15</column></source-position></method><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>pcal Nov 25, 2003</value></annotation-value></annotation><comment><![CDATA[Dummy class for JAM tests.]]></comment><source-position><line>9</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.FooImpl</name><is-interface>false</is-interface><modifiers>1025</modifiers><superclass>org.apache.xmlbeans.test.jam.dummyclasses.Base</superclass><interface>org.apache.xmlbeans.test.jam.dummyclasses.Foo</interface><constructor><modifiers>1</modifiers><source-position><line>12</line><column>17</column></source-position></constructor><method><name>getId</name><return-type>int</return-type><modifiers>1</modifiers><source-position><line>14</line><column>14</column></source-position></method><method><name>setId</name><return-type>void</return-type><modifiers>1</modifiers><parameter><name>id</name><type>int</type></parameter><source-position><line>16</line><column>15</column></source-position></method><method><name>setId2</name><return-type>void</return-type><modifiers>26</modifiers><parameter><name>id</name><type>double</type></parameter><source-position><line>18</line><column>29</column></source-position></method><method><name>setId3</name><return-type>void</return-type><modifiers>36</modifiers><parameter><name>id</name><type>double</type></parameter><parameter><name>id2</name><type>double</type></parameter><source-position><line>20</line><column>31</column></source-position></method><method><name>setId4</name><return-type>void</return-type><modifiers>1028</modifiers><parameter><name>id</name><type>double</type></parameter><parameter><name>id2</name><type>double</type></parameter><parameter><name>id3</name><type>double</type></parameter><source-position><line>22</line><column>27</column></source-position></method><method><name>methodDealingWithArrays</name><return-type>java.lang.String[][]</return-type><modifiers>0</modifiers><parameter><name>foo</name><type>int[]</type></parameter><parameter><name>bar</name><type>java.lang.Object[]</type></parameter><source-position><line>24</line><column>14</column></source-position></method><method><name>iThrowExceptions</name><return-type>void</return-type><modifiers>1028</modifiers><parameter><name>p1</name><type>int</type></parameter><parameter><name>p2</name><type>java.lang.String</type></parameter><source-position><line>28</line><column>27</column></source-position></method><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>pcal Nov 25, 2003</value></annotation-value></annotation><comment><![CDATA[Dummy class for JAM tests.]]></comment><source-position><line>12</line><column>17</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.ManyTags</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Object</superclass><constructor><modifiers>1</modifiers><source-position><line>20</line><column>8</column></source-position></constructor><method><name>getId</name><return-type>int</return-type><modifiers>1</modifiers><annotation><name>foo</name><annotation-value><name>x</name><type>java.lang.String</type><value>-43</value></annotation-value><annotation-value><name>z</name><type>java.lang.String</type><value>79</value></annotation-value><annotation-value><name>y</name><type>java.lang.String</type><value>124</value></annotation-value><annotation-value><name>y</name><type>java.lang.String</type><value>2</value></annotation-value><annotation-value><name>x</name><type>java.lang.String</type><value>1</value></annotation-value><annotation-value><name>z</name><type>java.lang.String</type><value>3</value></annotation-value><annotation-value><name>w</name><type>java.lang.String</type><value>0</value></annotation-value></annotation><annotation><name>baz</name><annotation-value><name>x</name><type>java.lang.String</type><value>1</value></annotation-value></annotation><annotation><name>bar</name><annotation-value><name>x</name><type>java.lang.String</type><value>-4343</value></annotation-value></annotation><source-position><line>33</line><column>14</column></source-position></method><comment><![CDATA[Tests case for javadoc tags is declared more than once in a document.]]></comment><source-position><line>20</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.MyException</name><is-interface>false</is-interface><modifiers>1</modifiers><superclass>java.lang.Exception</superclass><constructor><modifiers>1</modifiers><source-position><line>21</line><column>8</column></source-position></constructor><annotation><name>author</name><annotation-value><name>value</name><type>java.lang.String</type><value>Patrick Calahan &amp;lt;email: pcal-at-bea-dot-com&amp;gt;</value></annotation-value></annotation><source-position><line>21</line><column>8</column></source-position></class><class><name>org.apache.xmlbeans.test.jam.dummyclasses.HeavilyCommented</name><is-interface>false</is-interface><modifiers>1025</modifiers><superclass>java.lang.Object</superclass><constructor><modifiers>1</modifiers><source-position><line>21</line><column>17</column></source-position></constructor><method><name>simpleComment</name><return-type>void</return-type><modifiers>1028</modifiers><comment><![CDATA[A simple comment.]]></comment><source-position><line>26</line><column>27</column></source-position></method><method><name>multilineComment</name><return-type>void</return-type><modifiers>1028</modifiers><comment><![CDATA[A comment which
    spans
   
    several
  
  
  
  1.26      +36 -4     xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/JamTestBase.java
  
  Index: JamTestBase.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/JamTestBase.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- JamTestBase.java	11 May 2004 15:59:08 -0000	1.25
  +++ JamTestBase.java	12 May 2004 23:14:18 -0000	1.26
  @@ -97,7 +97,7 @@
     // ========================================================================
     // Constants
   
  -  private static final boolean CONTINUE_ON_COMPARE_FAIL = false;
  +  private static final boolean CONTINUE_ON_COMPARE_FAIL = true;
     private static final boolean WRITE_RESULT_ON_FAIL = true;
   
     private static final String WRITE_RESULT_PREFIX = "result-";
  @@ -559,16 +559,37 @@
     }
   
   
  -  public void testImports()
  +  public void testClassImports()
     {
       if (!isImportsAvailable()) return;
       JClass clazz = resolved(mLoader.loadClass(DUMMY+".ImportsGalore"));
       JClass[] imports = clazz.getImportedClasses();
  -    assertTrue("class has "+imports.length+" imports",
  -               imports.length == 3);
  +    final String[] IMPORTED_CLASSES = {
  +      "org.apache.xmlbeans.impl.jam.JClass",
  +      "javax.xml.stream.XMLStreamException",
  +      "java.util.Properties"
  +    };
  +    assertElementsNamed(imports,IMPORTED_CLASSES);
     }
   
   
  +  public void testPackageImports()
  +  {
  +    if (!isImportsAvailable()) return;
  +    JClass clazz = resolved(mLoader.loadClass(DUMMY+".ImportsGalore"));
  +    JPackage[] imports = clazz.getImportedPackages();
  +    final String[] IMPORTED_PACKAGES = {
  +      "java.lang",
  +      "java.lang.reflect",
  +      "java.util",
  +      "javax.xml.stream",
  +      "org.apache.xmlbeans.impl.jam"
  +    };
  +    assertElementsNamed(imports,IMPORTED_PACKAGES);
  +  }
  +
  +
  +
     public void testInterfaceIsAssignableFrom()
     {
       JClass fooImpl = resolved(mLoader.loadClass(DUMMY+".FooImpl"));
  @@ -665,6 +686,17 @@
   
     // ========================================================================
     // Private methods
  +
  +  private void assertElementsNamed(JElement[] elements, String[] qnames) {
  +    assertTrue("array not of correct length ["+
  +               elements.length+","+qnames.length+"]",
  +               (elements.length == qnames.length));
  +    for(int i=0; i<elements.length; i++) {
  +      String qn = elements[i].getQualifiedName();
  +      assertTrue("item "+i+" not correct ["+qn+","+qnames[i]+"]",
  +                 qn.equals(qnames[i]));
  +    }
  +  }
   
     private void compare(String result, String masterFileName) {
       try {
  
  
  
  1.12      +1 -1      xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/SourcesJamTest.java
  
  Index: SourcesJamTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/SourcesJamTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SourcesJamTest.java	2 Apr 2004 02:41:07 -0000	1.11
  +++ SourcesJamTest.java	12 May 2004 23:14:18 -0000	1.12
  @@ -97,7 +97,7 @@
   
     protected boolean isAnnotationsAvailable() { return true; }
   
  -  protected boolean isImportsAvailable() { return false; }
  +  protected boolean isImportsAvailable() { return true; }
   
     //kind of a quick hack for now, should remove this and make sure that
     //even the classes case make the annotations available using a special
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org