langtools/src/share/classes/com/sun/source/util/Trees.java
author briangoetz
Wed, 18 Dec 2013 16:05:18 -0500
changeset 22163 3651128c74eb
parent 20612 4761f3ff7afb
child 25287 d2440361b323
permissions -rw-r--r--
8030244: Update langtools to use Diamond Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
16303
b5dca0b42963 8008267: Add @Supported annotation to com.sun.source types
darcy
parents: 14548
diff changeset
     2
 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3149
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3149
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3149
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3149
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3149
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.source.util;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.lang.reflect.Method;
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents: 9599
diff changeset
    29
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import javax.annotation.processing.ProcessingEnvironment;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import javax.lang.model.element.AnnotationMirror;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import javax.lang.model.element.AnnotationValue;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import javax.lang.model.element.Element;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
import javax.lang.model.element.ExecutableElement;
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
import javax.lang.model.element.TypeElement;
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
import javax.lang.model.type.DeclaredType;
1257
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 10
diff changeset
    37
import javax.lang.model.type.ErrorType;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
import javax.lang.model.type.TypeMirror;
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
    39
import javax.tools.Diagnostic;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
import javax.tools.JavaCompiler.CompilationTask;
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
9599
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
    42
import com.sun.source.tree.CatchTree;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
import com.sun.source.tree.ClassTree;
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
import com.sun.source.tree.CompilationUnitTree;
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
import com.sun.source.tree.MethodTree;
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
import com.sun.source.tree.Scope;
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
import com.sun.source.tree.Tree;
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * Bridges JSR 199, JSR 269, and the Tree API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * @author Peter von der Ahé
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 */
20612
4761f3ff7afb 8025913: Rename jdk.Supported to jdk.Exported
darcy
parents: 16303
diff changeset
    54
@jdk.Exported
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
public abstract class Trees {
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * Gets a Trees object for a given CompilationTask.
7633
52b637b3b246 6986242: cut-n-paste error in javadoc for Trees.instance(ProcessingEnvironment)
jjg
parents: 7631
diff changeset
    58
     * @param task the compilation task for which to get the Trees object
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     * @throws IllegalArgumentException if the task does not support the Trees API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
    public static Trees instance(CompilationTask task) {
14548
aa687b312c97 8001098: Provide a simple light-weight "plug-in" mechanism for javac
jjg
parents: 14541
diff changeset
    62
        String taskClassName = task.getClass().getName();
aa687b312c97 8001098: Provide a simple light-weight "plug-in" mechanism for javac
jjg
parents: 14541
diff changeset
    63
        if (!taskClassName.equals("com.sun.tools.javac.api.JavacTaskImpl")
aa687b312c97 8001098: Provide a simple light-weight "plug-in" mechanism for javac
jjg
parents: 14541
diff changeset
    64
                && !taskClassName.equals("com.sun.tools.javac.api.BasicJavacTask"))
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
            throw new IllegalArgumentException();
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
        return getJavacTrees(CompilationTask.class, task);
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    /**
7633
52b637b3b246 6986242: cut-n-paste error in javadoc for Trees.instance(ProcessingEnvironment)
jjg
parents: 7631
diff changeset
    70
     * Gets a Trees object for a given ProcessingEnvironment.
52b637b3b246 6986242: cut-n-paste error in javadoc for Trees.instance(ProcessingEnvironment)
jjg
parents: 7631
diff changeset
    71
     * @param env the processing environment for which to get the Trees object
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     * @throws IllegalArgumentException if the env does not support the Trees API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    public static Trees instance(ProcessingEnvironment env) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
        if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
            throw new IllegalArgumentException();
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
        return getJavacTrees(ProcessingEnvironment.class, env);
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents: 9599
diff changeset
    80
    static Trees getJavacTrees(Class<?> argType, Object arg) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
            ClassLoader cl = arg.getClass().getClassLoader();
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
            Class<?> c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl);
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
            argType = Class.forName(argType.getName(), false, cl);
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 20612
diff changeset
    85
            Method m = c.getMethod("instance", argType);
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 20612
diff changeset
    86
            return (Trees) m.invoke(null, arg);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
        } catch (Throwable e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
            throw new AssertionError(e);
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     * Gets a utility object for obtaining source positions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    public abstract SourcePositions getSourcePositions();
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * Gets the Tree node for a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    public abstract Tree getTree(Element element);
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     * Gets the ClassTree node for a given TypeElement.
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    public abstract ClassTree getTree(TypeElement element);
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * Gets the MethodTree node for a given ExecutableElement.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    public abstract MethodTree getTree(ExecutableElement method);
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     * Gets the Tree node for an AnnotationMirror on a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    public abstract Tree getTree(Element e, AnnotationMirror a);
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
     * Gets the Tree node for an AnnotationValue for an AnnotationMirror on a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
    public abstract Tree getTree(Element e, AnnotationMirror a, AnnotationValue v);
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     * Gets the path to tree node within the specified compilation unit.
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    public abstract TreePath getPath(CompilationUnitTree unit, Tree node);
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * Gets the TreePath node for a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    public abstract TreePath getPath(Element e);
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * Gets the TreePath node for an AnnotationMirror on a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    public abstract TreePath getPath(Element e, AnnotationMirror a);
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     * Gets the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    public abstract TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v);
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * Gets the Element for the Tree node identified by a given TreePath.
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * Returns null if the element is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * @throws IllegalArgumentException is the TreePath does not identify
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     * a Tree node that might have an associated Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
    public abstract Element getElement(TreePath path);
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
     * Gets the TypeMirror for the Tree node identified by a given TreePath.
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * Returns null if the TypeMirror is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     * @throws IllegalArgumentException is the TreePath does not identify
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * a Tree node that might have an associated TypeMirror.
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    public abstract TypeMirror getTypeMirror(TreePath path);
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     * Gets the Scope for the Tree node identified by a given TreePath.
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     * Returns null if the Scope is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    public abstract Scope getScope(TreePath path);
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    /**
7631
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   173
     * Gets the doc comment, if any, for the Tree node identified by a given TreePath.
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   174
     * Returns null if no doc comment was found.
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents: 9599
diff changeset
   175
     * @see DocTrees#getDocCommentTree(TreePath)
7631
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   176
     */
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   177
    public abstract String getDocComment(TreePath path);
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   178
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   179
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     * Checks whether a given type is accessible in a given scope.
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
     * @param scope the scope to be checked
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
     * @param type the type to be checked
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     * @return true if {@code type} is accessible
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    public abstract boolean isAccessible(Scope scope, TypeElement type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     * Checks whether the given element is accessible as a member of the given
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * type in a given scope.
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     * @param scope the scope to be checked
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     * @param member the member to be checked
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     * @param type the type for which to check if the member is accessible
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * @return true if {@code member} is accessible in {@code type}
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    public abstract boolean isAccessible(Scope scope, Element member, DeclaredType type);
1257
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 10
diff changeset
   196
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 10
diff changeset
   197
    /**
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 10
diff changeset
   198
      * Gets the original type from the ErrorType object.
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 10
diff changeset
   199
      * @param errorType The errorType for which we want to get the original type.
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   200
      * @return javax.lang.model.type.TypeMirror corresponding to the original type, replaced by the ErrorType.
1257
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 10
diff changeset
   201
      */
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 10
diff changeset
   202
    public abstract TypeMirror getOriginalType(ErrorType errorType);
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   203
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   204
    /**
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   205
     * Prints a message of the specified kind at the location of the
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   206
     * tree within the provided compilation unit
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   207
     *
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   208
     * @param kind the kind of message
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   209
     * @param msg  the message, or an empty string if none
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   210
     * @param t    the tree to use as a position hint
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   211
     * @param root the compilation unit that contains tree
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   212
     */
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   213
    public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg,
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   214
            com.sun.source.tree.Tree t,
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   215
            com.sun.source.tree.CompilationUnitTree root);
9599
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
   216
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
   217
    /**
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
   218
     * Gets the lub of an exception parameter declared in a catch clause.
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
   219
     * @param tree the tree for the catch clause
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
   220
     * @return The lub of the exception parameter
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
   221
     */
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
   222
    public abstract TypeMirror getLub(CatchTree tree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
}