classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] [generics] Patch: FYI: annotations


From: Tom Tromey
Subject: [cp-patches] [generics] Patch: FYI: annotations
Date: 07 Aug 2004 12:44:27 -0600

I'm checking this in on the generics branch.
Once again, completely untested and as yet undocumented.
This adds all of java.lang.annotation, which is the necessary library
support for the new 1.5 annotations feature.  (The runtime support,
which is mostly in java.lang.reflect, I still haven't done.)

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * java/lang/annotation/AnnotationFormatError.java: New file.
        * java/lang/annotation/IncompleteAnnotationException.java: New
        file.
        * java/lang/annotation/AnnotationTypeMismatchException.java: New
        file.
        * java/lang/annotation/RetentionPolicy.java: New file.
        * java/lang/annotation/ElementType.java: New file.
        * java/lang/annotation/Target.java: New file.
        * java/lang/annotation/Retention.java: New file.
        * java/lang/annotation/Inherited.java: New file.
        * java/lang/annotation/Documented.java: New file.
        * java/lang/annotation/Annotation.java: New file.
        * java/lang/Override.java: Fixed formatting.
        * java/lang/Deprecated.java: Now Documented.

Index: java/lang/Deprecated.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Attic/Deprecated.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 Deprecated.java
--- java/lang/Deprecated.java 7 Aug 2004 00:27:06 -0000 1.1.2.1
+++ java/lang/Deprecated.java 7 Aug 2004 18:58:43 -0000
@@ -37,7 +37,7 @@
 
 package java.lang;
 
address@hidden(SOURCE)
address@hidden @Retention(SOURCE)
 public @interface Deprecated
 {
 }
Index: java/lang/Override.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Attic/Override.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 Override.java
--- java/lang/Override.java 7 Aug 2004 00:27:06 -0000 1.1.2.1
+++ java/lang/Override.java 7 Aug 2004 18:58:44 -0000
@@ -37,8 +37,7 @@
 
 package java.lang;
 
address@hidden(SOURCE)
address@hidden(METHOD)
address@hidden(SOURCE) @Target(METHOD)
 public @interface Override
 {
 }
Index: java/lang/annotation/Annotation.java
===================================================================
RCS file: java/lang/annotation/Annotation.java
diff -N java/lang/annotation/Annotation.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/Annotation.java 7 Aug 2004 18:58:44 -0000
@@ -0,0 +1,49 @@
+/* Annotation.java - Base interface for all annotations
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
+public interface Annotation
+{
+  Class<? extends Annotation> annotationType();
+  boolean equals(Object o);
+  int hashCode();
+  String toString();
+}
Index: java/lang/annotation/AnnotationFormatError.java
===================================================================
RCS file: java/lang/annotation/AnnotationFormatError.java
diff -N java/lang/annotation/AnnotationFormatError.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/AnnotationFormatError.java 7 Aug 2004 18:58:44 -0000
@@ -0,0 +1,59 @@
+/* AnnotationFormatError.java - Thrown when annotation is malformed in class
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
+public class AnnotationFormatError extends Error
+{
+  public AnnotationFormatError(String message)
+  {
+    super(message);
+  }
+
+  public AnnotationFormatError(String message, Throwable cause)
+  {
+    super(message, cause);
+  }
+
+  public AnnotationFormatError(Throwable cause)
+  {
+    super(cause);
+  }
+}
Index: java/lang/annotation/AnnotationTypeMismatchException.java
===================================================================
RCS file: java/lang/annotation/AnnotationTypeMismatchException.java
diff -N java/lang/annotation/AnnotationTypeMismatchException.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/AnnotationTypeMismatchException.java 7 Aug 2004 
18:58:44 -0000
@@ -0,0 +1,64 @@
+/* AnnotationTypeMismatchException.java - Thrown when annotation has changed
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
+public class AnnotationTypeMismatchException extends RuntimeException
+{
+  public AnnotationTypeMismatchException(Method m, String type)
+  {
+    this.element = m;
+    this.foundType = type;
+  }
+
+  public Method element()
+  {
+    return element;
+  }
+
+  public String foundType()
+  {
+    return foundType;
+  }
+
+  // Names are chosen from serialization spec.
+  private Method element;
+  private String foundType;
+}
Index: java/lang/annotation/Documented.java
===================================================================
RCS file: java/lang/annotation/Documented.java
diff -N java/lang/annotation/Documented.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/Documented.java 7 Aug 2004 18:58:44 -0000
@@ -0,0 +1,46 @@
+/* Documented.java - Indicates documented source element
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
address@hidden @Retention(RUNTIME)
+public @interface Documented
+{
+}
Index: java/lang/annotation/ElementType.java
===================================================================
RCS file: java/lang/annotation/ElementType.java
diff -N java/lang/annotation/ElementType.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/ElementType.java 7 Aug 2004 18:58:44 -0000
@@ -0,0 +1,53 @@
+/* ElementType.java - Enum listing Java source elements
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
+public enum ElementType
+{
+  ANNOTATION_TYPE,
+  CONSTRUCTOR,
+  FIELD,
+  LOCAL_VARIABLE,
+  METHOD,
+  PACKAGE,
+  PARAMETER,
+  TYPE
+}
Index: java/lang/annotation/IncompleteAnnotationException.java
===================================================================
RCS file: java/lang/annotation/IncompleteAnnotationException.java
diff -N java/lang/annotation/IncompleteAnnotationException.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/IncompleteAnnotationException.java 7 Aug 2004 18:58:44 
-0000
@@ -0,0 +1,65 @@
+/* IncompleteAnnotationException.java - Thrown when annotation has changed
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
+public class IncompleteAnnotationException extends RuntimeException
+{
+  public IncompleteAnnotationException(Class<? extends Annotation> type,
+                                      String name)
+  {
+    this.annotationType = type;
+    this.elementName = name;
+  }
+
+  public Class<? extends Annotation> annotationType()
+  {
+    return annotationType;
+  }
+
+  public String elementName()
+  {
+    return elementName;
+  }
+
+  // Names are chosen from serialization spec.
+  private Class<? extends Annotation> annotationType;
+  private String elementName;
+}
Index: java/lang/annotation/Inherited.java
===================================================================
RCS file: java/lang/annotation/Inherited.java
diff -N java/lang/annotation/Inherited.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/Inherited.java 7 Aug 2004 18:58:44 -0000
@@ -0,0 +1,46 @@
+/* Inherited.java - Indicates inherited annotation
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
address@hidden @Retention(RUNTIME) @Target(ANNOTATION_TYPE)
+public @interface Inherited
+{
+}
Index: java/lang/annotation/Retention.java
===================================================================
RCS file: java/lang/annotation/Retention.java
diff -N java/lang/annotation/Retention.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/Retention.java 7 Aug 2004 18:58:44 -0000
@@ -0,0 +1,47 @@
+/* Retention.java - Retention policy for an annotation
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
address@hidden @Retention(RUNTIME) @Target(ANNOTATION_TYPE)
+public @interface Retention
+{
+  RetentionPolicy value();
+}
Index: java/lang/annotation/RetentionPolicy.java
===================================================================
RCS file: java/lang/annotation/RetentionPolicy.java
diff -N java/lang/annotation/RetentionPolicy.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/RetentionPolicy.java 7 Aug 2004 18:58:44 -0000
@@ -0,0 +1,48 @@
+/* RetentionPolicy.java - Enum listing lifetimes for an annotation
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
+public enum RetentionPolicy
+{
+  CLASS,
+  RUNTIME,
+  SOURCE
+}
Index: java/lang/annotation/Target.java
===================================================================
RCS file: java/lang/annotation/Target.java
diff -N java/lang/annotation/Target.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/annotation/Target.java 7 Aug 2004 18:58:44 -0000
@@ -0,0 +1,47 @@
+/* Target.java - Indicate where an annotation may be applied
+   Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.annotation;
+
+/**
+ * @since 1.5
+ */
address@hidden @Retention(RUNTIME) @Target(ANNOTATION_TYPE)
+public @interface Target
+{
+  ElementType[] value();
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]