[geotk] Problem with org.geoapi

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Sat May 21 17:22:56 EDT 2011


Hello Brian

Thanks for spotting that! I remember to have heard that Eclipse users had a 
similar issue too. Circular dependencies are often allowed in Java (class A can 
depends on class B which depends on A - and same for methods), but its look like 
that this kind of circular dependencies is not widely supported on annotations, 
except by the Sun javac compiler.

Tomorrow, I will try to remove the annotations on the 
org.opengis.metadata.Obligation enum. Hopefully it would be suffisient.

Regards,

     Martin



Le 21/05/11 22:53, Brian Schlining a écrit :
> I found the problem. There is a circular dependency between org.opengis.metadata.Obligation.java and org.opengis.annotation.Obligation.java. The classes that were causing the compiler to bomb were all using the @UML annotation with a parameter that reference fields in the Obligation object (which in turn references the Obligation annotation, which in turn references fields in the Obligation object). I commented out the use of the @UML annotation in both the Obligation source files and the project I posted compiled just fine. Here's the diffs:
>
> Index: geoapi/src/main/java/org/opengis/metadata/Obligation.java
> ===================================================================
> --- geoapi/src/main/java/org/opengis/metadata/Obligation.java (revision 1635)
> +++ geoapi/src/main/java/org/opengis/metadata/Obligation.java (working copy)
> @@ -46,7 +46,7 @@
> * @version 3.0
> * @since  2.0
> */
> - at UML(identifier="MD_ObligationCode", specification=ISO_19115)
> +//@UML(identifier="MD_ObligationCode", specification=ISO_19115)
> public final class Obligation extends CodeList<Obligation>  {
>   /**
> * Serial number for compatibility with different versions.
> @@ -62,19 +62,19 @@
>   /**
> * Element is always required.
> */
> - @UML(identifier="mandatory", obligation=org.opengis.annotation.Obligation.CONDITIONAL, specification=ISO_19115)
> + //@UML(identifier="mandatory", obligation=org.opengis.annotation.Obligation.CONDITIONAL, specification=ISO_19115)
>   public static final Obligation MANDATORY = new Obligation("MANDATORY");
>
>   /**
> * Element is not required.
> */
> - @UML(identifier="optional", obligation=org.opengis.annotation.Obligation.CONDITIONAL, specification=ISO_19115)
> + //@UML(identifier="optional", obligation=org.opengis.annotation.Obligation.CONDITIONAL, specification=ISO_19115)
>   public static final Obligation OPTIONAL = new Obligation("OPTIONAL");
>
>   /**
> * Element is required when a specific condition is met.
> */
> - @UML(identifier="conditional", obligation=org.opengis.annotation.Obligation.CONDITIONAL, specification=ISO_19115)
> + //@UML(identifier="conditional", obligation=org.opengis.annotation.Obligation.CONDITIONAL, specification=ISO_19115)
>   public static final Obligation CONDITIONAL = new Obligation("CONDITIONAL");
>
>   /**
>
>
> Index: geoapi/src/main/java/org/opengis/annotation/Obligation.java
> ===================================================================
> --- geoapi/src/main/java/org/opengis/annotation/Obligation.java (revision 1635)
> +++ geoapi/src/main/java/org/opengis/annotation/Obligation.java (working copy)
> @@ -43,24 +43,24 @@
> * @version 3.0
> * @since  2.0
> */
> - at UML(identifier="MD_ObligationCode", specification=ISO_19115)
> +//@UML(identifier="MD_ObligationCode", specification=ISO_19115)
> public enum Obligation {
>   /**
> * Element is required when a specific condition is met.
> */
> - @UML(identifier="conditional", obligation=CONDITIONAL, specification=ISO_19115)
> + //@UML(identifier="conditional", obligation=CONDITIONAL, specification=ISO_19115)
>   CONDITIONAL,
>
>   /**
> * Element is not required.
> */
> - @UML(identifier="optional", obligation=CONDITIONAL, specification=ISO_19115)
> + //@UML(identifier="optional", obligation=CONDITIONAL, specification=ISO_19115)
>   OPTIONAL,
>
>   /**
> * Element is always required.
> */
> - @UML(identifier="mandatory", obligation=CONDITIONAL, specification=ISO_19115)
> + //@UML(identifier="mandatory", obligation=CONDITIONAL, specification=ISO_19115)
>   MANDATORY,
>
>   /**
>
>
>


More information about the Geotoolkit mailing list