langtools/src/share/classes/com/sun/source/util/Trees.java
author jjg
Mon, 19 Nov 2012 11:38:49 -0800
changeset 14548 aa687b312c97
parent 14541 36f9d11fc9aa
child 16303 b5dca0b42963
permissions -rw-r--r--
8001098: Provide a simple light-weight "plug-in" mechanism for javac Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents: 9599
diff changeset
     2
 * Copyright (c) 2005, 2012, 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
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
public abstract class Trees {
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     * 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
    57
     * @param task the compilation task for which to get the Trees object
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * @throws IllegalArgumentException if the task does not support the Trees API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
    public static Trees instance(CompilationTask task) {
14548
aa687b312c97 8001098: Provide a simple light-weight "plug-in" mechanism for javac
jjg
parents: 14541
diff changeset
    61
        String taskClassName = task.getClass().getName();
aa687b312c97 8001098: Provide a simple light-weight "plug-in" mechanism for javac
jjg
parents: 14541
diff changeset
    62
        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
    63
                && !taskClassName.equals("com.sun.tools.javac.api.BasicJavacTask"))
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
            throw new IllegalArgumentException();
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        return getJavacTrees(CompilationTask.class, task);
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    /**
7633
52b637b3b246 6986242: cut-n-paste error in javadoc for Trees.instance(ProcessingEnvironment)
jjg
parents: 7631
diff changeset
    69
     * 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
    70
     * @param env the processing environment for which to get the Trees object
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * @throws IllegalArgumentException if the env does not support the Trees API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    public static Trees instance(ProcessingEnvironment env) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
        if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
            throw new IllegalArgumentException();
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
        return getJavacTrees(ProcessingEnvironment.class, env);
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents: 9599
diff changeset
    79
    static Trees getJavacTrees(Class<?> argType, Object arg) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
            ClassLoader cl = arg.getClass().getClassLoader();
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
            Class<?> c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl);
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
            argType = Class.forName(argType.getName(), false, cl);
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
    84
            Method m = c.getMethod("instance", new Class<?>[] { argType });
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
            return (Trees) m.invoke(null, new Object[] { arg });
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
        } catch (Throwable e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
            throw new AssertionError(e);
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
        }
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
     * Gets a utility object for obtaining source positions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    public abstract SourcePositions getSourcePositions();
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * Gets the Tree node for a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    public abstract Tree getTree(Element element);
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     * Gets the ClassTree node for a given TypeElement.
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    public abstract ClassTree getTree(TypeElement element);
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * Gets the MethodTree node for a given ExecutableElement.
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    public abstract MethodTree getTree(ExecutableElement method);
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * Gets the Tree node for an AnnotationMirror on a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    public abstract Tree getTree(Element e, AnnotationMirror a);
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     * Gets the Tree node for an AnnotationValue for an AnnotationMirror on a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
    public abstract Tree getTree(Element e, AnnotationMirror a, AnnotationValue v);
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * Gets the path to tree node within the specified compilation unit.
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    public abstract TreePath getPath(CompilationUnitTree unit, Tree node);
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     * Gets the TreePath node for a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    public abstract TreePath getPath(Element e);
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * Gets the TreePath node for an AnnotationMirror on a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    public abstract TreePath getPath(Element e, AnnotationMirror a);
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * Gets the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     * Returns null if the node can not be found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    public abstract TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v);
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     * Gets the Element for the Tree node identified by a given TreePath.
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * Returns null if the element is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * @throws IllegalArgumentException is the TreePath does not identify
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * a Tree node that might have an associated Element.
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    public abstract Element getElement(TreePath path);
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
     * Gets the TypeMirror for the Tree node identified by a given TreePath.
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
     * Returns null if the TypeMirror is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * @throws IllegalArgumentException is the TreePath does not identify
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     * a Tree node that might have an associated TypeMirror.
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    public abstract TypeMirror getTypeMirror(TreePath path);
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     * Gets the Scope for the Tree node identified by a given TreePath.
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     * Returns null if the Scope is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
    public abstract Scope getScope(TreePath path);
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    /**
7631
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   172
     * 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
   173
     * 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
   174
     * @see DocTrees#getDocCommentTree(TreePath)
7631
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   175
     */
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   176
    public abstract String getDocComment(TreePath path);
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   177
57bce845dcee 6985202: no access to doc comments from Tree API
jjg
parents: 5520
diff changeset
   178
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     * Checks whether a given type is accessible in a given scope.
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     * @param scope the scope to be checked
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
     * @param type the type to be checked
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
     * @return true if {@code type} is accessible
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
    public abstract boolean isAccessible(Scope scope, TypeElement type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     * Checks whether the given element is accessible as a member of the given
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     * type in a given scope.
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * @param scope the scope to be checked
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     * @param member the member to be checked
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     * @param type the type for which to check if the member is accessible
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     * @return true if {@code member} is accessible in {@code type}
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
    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
   195
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
      * 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
   198
      * @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
   199
      * @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
   200
      */
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
    public abstract TypeMirror getOriginalType(ErrorType errorType);
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   202
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
     * Prints a message of the specified kind at the location of the
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   205
     * tree within the provided compilation unit
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   206
     *
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   207
     * @param kind the kind of message
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   208
     * @param msg  the message, or an empty string if none
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   209
     * @param t    the tree to use as a position hint
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   210
     * @param root the compilation unit that contains tree
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   211
     */
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   212
    public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg,
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   213
            com.sun.source.tree.Tree t,
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 1789
diff changeset
   214
            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
   215
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
     * 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
   218
     * @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
   219
     * @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
   220
     */
0996df19ea87 7029150: Project Coin: present union types from the tree API through to javax.lang.model
jjg
parents: 7681
diff changeset
   221
    public abstract TypeMirror getLub(CatchTree tree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
}