src/share/classes/javax/lang/model/type/MirroredTypesException.java

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
9a66ca7c79fa
child 193
18c433be7aa7
permissions
-rw-r--r--

Initial load

     1 /*
     2  * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Sun designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Sun in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
    23  * have any questions.
    24  */
    26 package javax.lang.model.type;
    29 import java.lang.annotation.Annotation;
    30 import java.util.ArrayList;
    31 import java.util.List;
    32 import java.util.Collections;
    34 import javax.lang.model.element.Element;
    37 /**
    38  * Thrown when an application attempts to access a sequence of {@link
    39  * Class} objects each corresponding to a {@link TypeMirror}.
    40  *
    41  * @author Joseph D. Darcy
    42  * @author Scott Seligman
    43  * @author Peter von der Ahé
    44  * @see MirroredTypeException
    45  * @see Element#getAnnotation(Class)
    46  * @since 1.6
    47  */
    48 public class MirroredTypesException extends RuntimeException {
    50     private static final long serialVersionUID = 269;
    52     // Should this be non-final for a custum readObject method?
    53     private final transient List<? extends TypeMirror> types;   // cannot be serialized
    55     /**
    56      * Constructs a new MirroredTypesException for the specified types.
    57      *
    58      * @param types  the types being accessed
    59      */
    60     public MirroredTypesException(List<? extends TypeMirror> types) {
    61         super("Attempt to access Class objects for TypeMirrors " + types);
    62         this.types = Collections.unmodifiableList(types);
    63     }
    65     /**
    66      * Returns the type mirrors corresponding to the types being accessed.
    67      * The type mirrors may be unavailable if this exception has been
    68      * serialized and then read back in.
    69      *
    70      * @return the type mirrors in construction order, or {@code null} if unavailable
    71      */
    72     public List<? extends TypeMirror> getTypeMirrors() {
    73         return types;
    74     }
    75 }

mercurial