langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
author mcimadamore
Fri, 16 Dec 2016 15:27:34 +0000
changeset 42827 36468b5fa7f4
parent 42411 2433ceacb13e
child 42828 cce89649f958
permissions -rw-r--r--
8181370: Convert anonymous inner classes into lambdas/method references Reviewed-by: jjg, rfield, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
     2
 * Copyright (c) 1999, 2016, 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: 5008
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: 5008
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: 5008
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5008
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5008
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.tools.javac.comp;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
    28
import java.util.Map;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
    29
import java.util.Optional;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
    30
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import javax.tools.JavaFileObject;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import javax.tools.JavaFileManager;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
import com.sun.tools.javac.code.*;
27224
228abfa87080 8054457: Refactor Symbol kinds from small ints to an enum
emc
parents: 25874
diff changeset
    35
import com.sun.tools.javac.code.Kinds.KindSelector;
7615
8bc078486f2b 7004029: intermittent failures compiling pack200
jjg
parents: 6709
diff changeset
    36
import com.sun.tools.javac.code.Scope.*;
8bc078486f2b 7004029: intermittent failures compiling pack200
jjg
parents: 6709
diff changeset
    37
import com.sun.tools.javac.code.Symbol.*;
8bc078486f2b 7004029: intermittent failures compiling pack200
jjg
parents: 6709
diff changeset
    38
import com.sun.tools.javac.code.Type.*;
11314
b612aaca08d0 7120736: refactor javac option handling
jjg
parents: 10950
diff changeset
    39
import com.sun.tools.javac.main.Option.PkgInfo;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
    40
import com.sun.tools.javac.resources.CompilerProperties.Errors;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
import com.sun.tools.javac.tree.*;
7615
8bc078486f2b 7004029: intermittent failures compiling pack200
jjg
parents: 6709
diff changeset
    42
import com.sun.tools.javac.tree.JCTree.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
import com.sun.tools.javac.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
import com.sun.tools.javac.util.List;
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
import static com.sun.tools.javac.code.Flags.*;
27224
228abfa87080 8054457: Refactor Symbol kinds from small ints to an enum
emc
parents: 25874
diff changeset
    48
import static com.sun.tools.javac.code.Kinds.Kind.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
/** This class enters symbols for all encountered definitions into
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    51
 *  the symbol table. The pass consists of high-level two phases,
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    52
 *  organized as follows:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 *
14359
d4099818ab70 7200915: convert TypeTags from a series of small ints to an enum
jjg
parents: 13844
diff changeset
    54
 *  <p>In the first phase, all class symbols are entered into their
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 *  enclosing scope, descending recursively down the tree for classes
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 *  which are members of other classes. The class symbols are given a
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    57
 *  TypeEnter object as completer.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 *  <p>In the second phase classes are completed using
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    60
 *  TypeEnter.complete(). Completion might occur on demand, but
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 *  any classes that are not completed that way will be eventually
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    62
 *  completed by processing the `uncompleted' queue. Completion
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    63
 *  entails determination of a class's parameters, supertype and
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    64
 *  interfaces, as well as entering all symbols defined in the
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 *  class into its scope, with the exception of class symbols which
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    66
 *  have been entered in phase 1.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
 *  <p>Whereas the first phase is organized as a sweep through all
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    69
 *  compiled syntax trees, the second phase is on-demand. Members of a
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
 *  class are entered when the contents of a class are first
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
 *  accessed. This is accomplished by installing completer objects in
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    72
 *  class symbols for compiled classes which invoke the type-enter
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
 *  phase for the corresponding class tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
 *  <p>Classes migrate from one phase to the next via queues:
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
 *
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 13689
diff changeset
    77
 *  <pre>{@literal
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    78
 *  class enter -> (Enter.uncompleted)         --> type enter
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
 *              -> (Todo)                      --> attribute
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
 *                                              (only for toplevel classes)
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 13689
diff changeset
    81
 *  }</pre>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    83
 *  <p><b>This is NOT part of any supported API.
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    84
 *  If you write code that depends on this, you do so at your own risk.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
 *  This code and its internal interfaces are subject to change or
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
 *  deletion without notice.</b>
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
public class Enter extends JCTree.Visitor {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 20235
diff changeset
    89
    protected static final Context.Key<Enter> enterKey = new Context.Key<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
29842
826ac2519523 8031744: Annotations on many Language Model elements are not returned
jjg
parents: 29776
diff changeset
    91
    Annotate annotate;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    Log log;
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    Symtab syms;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    Check chk;
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    TreeMaker make;
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
    96
    TypeEnter typeEnter;
1257
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 1206
diff changeset
    97
    Types types;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    Lint lint;
4871
655bba719625 6499119: Created package-info class file modeled improperly
jjg
parents: 1264
diff changeset
    99
    Names names;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    JavaFileManager fileManager;
6575
ae1798028008 6960424: new option -Xpkginfo for better control of when package-info.class is generated
jjg
parents: 5847
diff changeset
   101
    PkgInfo pkginfoOpt;
25007
eb097d3a68f5 8038975: Access control in enhanced for
pgovereau
parents: 24604
diff changeset
   102
    TypeEnvs typeEnvs;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   103
    Modules modules;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   104
    JCDiagnostic.Factory diags;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    private final Todo todo;
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
    public static Enter instance(Context context) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
        Enter instance = context.get(enterKey);
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
        if (instance == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
            instance = new Enter(context);
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
        return instance;
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    protected Enter(Context context) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
        context.put(enterKey, this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        log = Log.instance(context);
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        make = TreeMaker.instance(context);
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        syms = Symtab.instance(context);
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        chk = Check.instance(context);
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
   122
        typeEnter = TypeEnter.instance(context);
1257
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 1206
diff changeset
   123
        types = Types.instance(context);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        annotate = Annotate.instance(context);
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        lint = Lint.instance(context);
4871
655bba719625 6499119: Created package-info class file modeled improperly
jjg
parents: 1264
diff changeset
   126
        names = Names.instance(context);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   127
        modules = Modules.instance(context);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   128
        diags = JCDiagnostic.Factory.instance(context);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
        predefClassDef = make.ClassDef(
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
            make.Modifiers(PUBLIC),
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14359
diff changeset
   132
            syms.predefClass.name,
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14359
diff changeset
   133
            List.<JCTypeParameter>nil(),
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14359
diff changeset
   134
            null,
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14359
diff changeset
   135
            List.<JCExpression>nil(),
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14359
diff changeset
   136
            List.<JCTree>nil());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        predefClassDef.sym = syms.predefClass;
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
        todo = Todo.instance(context);
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
        fileManager = context.get(JavaFileManager.class);
6575
ae1798028008 6960424: new option -Xpkginfo for better control of when package-info.class is generated
jjg
parents: 5847
diff changeset
   140
ae1798028008 6960424: new option -Xpkginfo for better control of when package-info.class is generated
jjg
parents: 5847
diff changeset
   141
        Options options = Options.instance(context);
ae1798028008 6960424: new option -Xpkginfo for better control of when package-info.class is generated
jjg
parents: 5847
diff changeset
   142
        pkginfoOpt = PkgInfo.get(options);
25007
eb097d3a68f5 8038975: Access control in enhanced for
pgovereau
parents: 24604
diff changeset
   143
        typeEnvs = TypeEnvs.instance(context);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    /** Accessor for typeEnvs
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    public Env<AttrContext> getEnv(TypeSymbol sym) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        return typeEnvs.get(sym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
23810
b92eb80925f0 8038455: Use single Context for all rounds of annotation processing
jlahoda
parents: 22442
diff changeset
   152
    public Iterable<Env<AttrContext>> getEnvs() {
b92eb80925f0 8038455: Use single Context for all rounds of annotation processing
jlahoda
parents: 22442
diff changeset
   153
        return typeEnvs.values();
b92eb80925f0 8038455: Use single Context for all rounds of annotation processing
jlahoda
parents: 22442
diff changeset
   154
    }
b92eb80925f0 8038455: Use single Context for all rounds of annotation processing
jlahoda
parents: 22442
diff changeset
   155
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
    public Env<AttrContext> getClassEnv(TypeSymbol sym) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        Env<AttrContext> localEnv = getEnv(sym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        Env<AttrContext> lintEnv = localEnv;
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        while (lintEnv.info.lint == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            lintEnv = lintEnv.next;
18010
604faee85350 8004643: Reduce javac space overhead introduced with compiler support for repeating annotations
jjg
parents: 15354
diff changeset
   161
        localEnv.info.lint = lintEnv.info.lint.augment(sym);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
        return localEnv;
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    /** The queue of all classes that might still need to be completed;
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     *  saved and initialized by main().
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
    ListBuffer<ClassSymbol> uncompleted;
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   170
    /** The queue of modules whose imports still need to be checked. */
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   171
    ListBuffer<JCCompilationUnit> unfinishedModules = new ListBuffer<>();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   172
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
    /** A dummy class to serve as enclClass for toplevel environments.
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    private JCClassDecl predefClassDef;
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
/* ************************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
 * environment construction
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
 *************************************************************************/
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
    /** Create a fresh environment for class bodies.
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     *  This will create a fresh scope for local symbols of a class, referred
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     *  to by the environments info.scope field.
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     *  This scope will contain
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     *    - symbols for this and super
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     *    - symbols for any type parameters
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     *  In addition, it serves as an anchor for scopes of methods and initializers
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     *  which are nested in this scope via Scope.dup().
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     *  This scope should not be confused with the members scope of a class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     *  @param tree     The class definition.
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     *  @param env      The environment current outside of the class definition.
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    public Env<AttrContext> classEnv(JCClassDecl tree, Env<AttrContext> env) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        Env<AttrContext> localEnv =
25443
9187d77f2c64 8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents: 25007
diff changeset
   197
            env.dup(tree, env.info.dup(WriteableScope.create(tree.sym)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
        localEnv.enclClass = tree;
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
        localEnv.outer = env;
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
        localEnv.info.isSelfCall = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
        localEnv.info.lint = null; // leave this to be filled in by Attr,
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
                                   // when annotations have been processed
29776
984a79b71cfe 8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents: 28589
diff changeset
   203
        localEnv.info.isAnonymousDiamond = TreeInfo.isDiamond(env.tree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        return localEnv;
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
    /** Create a fresh environment for toplevels.
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     *  @param tree     The toplevel tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    Env<AttrContext> topLevelEnv(JCCompilationUnit tree) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 20235
diff changeset
   211
        Env<AttrContext> localEnv = new Env<>(tree, new AttrContext());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
        localEnv.toplevel = tree;
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
        localEnv.enclClass = predefClassDef;
25443
9187d77f2c64 8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents: 25007
diff changeset
   214
        tree.toplevelScope = WriteableScope.create(tree.packge);
9187d77f2c64 8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents: 25007
diff changeset
   215
        tree.namedImportScope = new NamedImportScope(tree.packge, tree.toplevelScope);
7615
8bc078486f2b 7004029: intermittent failures compiling pack200
jjg
parents: 6709
diff changeset
   216
        tree.starImportScope = new StarImportScope(tree.packge);
25443
9187d77f2c64 8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents: 25007
diff changeset
   217
        localEnv.info.scope = tree.toplevelScope;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
        localEnv.info.lint = lint;
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
        return localEnv;
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
    public Env<AttrContext> getTopLevelEnv(JCCompilationUnit tree) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 20235
diff changeset
   223
        Env<AttrContext> localEnv = new Env<>(tree, new AttrContext());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
        localEnv.toplevel = tree;
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
        localEnv.enclClass = predefClassDef;
25443
9187d77f2c64 8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents: 25007
diff changeset
   226
        localEnv.info.scope = tree.toplevelScope;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
        localEnv.info.lint = lint;
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
        return localEnv;
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
    /** The scope in which a member definition in environment env is to be entered
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     *  This is usually the environment's scope, except for class environments,
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
     *  where the local scope is for type variables, and the this and super symbol
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
     *  only, and members go into the class member scope.
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
     */
25443
9187d77f2c64 8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents: 25007
diff changeset
   236
    WriteableScope enterScope(Env<AttrContext> env) {
10950
e87b50888909 6921494: provide way to print javac tree tag values
jjg
parents: 9087
diff changeset
   237
        return (env.tree.hasTag(JCTree.Tag.CLASSDEF))
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
            ? ((JCClassDecl) env.tree).sym.members_field
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
            : env.info.scope;
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   242
    /** Create a fresh environment for modules.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   243
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   244
     *  @param tree     The module definition.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   245
     *  @param env      The environment current outside of the module definition.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   246
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   247
    public Env<AttrContext> moduleEnv(JCModuleDecl tree, Env<AttrContext> env) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   248
        Assert.checkNonNull(tree.sym);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   249
        Env<AttrContext> localEnv =
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   250
            env.dup(tree, env.info.dup(WriteableScope.create(tree.sym)));
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   251
        localEnv.enclClass = predefClassDef;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   252
        localEnv.outer = env;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   253
        localEnv.info.isSelfCall = false;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   254
        localEnv.info.lint = null; // leave this to be filled in by Attr,
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   255
                                   // when annotations have been processed
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   256
        return localEnv;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   257
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   258
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   259
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
/* ************************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
 * Visitor methods for phase 1: class enter
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
 *************************************************************************/
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
    /** Visitor argument: the current environment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
    protected Env<AttrContext> env;
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
    /** Visitor result: the computed type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
    Type result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
    /** Visitor method: enter all classes in given tree, catching any
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
     *  completion failure exceptions. Return the tree's type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
     *  @param tree    The tree to be visited.
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
     *  @param env     The environment visitor argument.
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
    Type classEnter(JCTree tree, Env<AttrContext> env) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
        Env<AttrContext> prevEnv = this.env;
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
            this.env = env;
29842
826ac2519523 8031744: Annotations on many Language Model elements are not returned
jjg
parents: 29776
diff changeset
   282
            annotate.blockAnnotations();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
            tree.accept(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
            return result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
        }  catch (CompletionFailure ex) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
            return chk.completionError(tree.pos(), ex);
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        } finally {
29842
826ac2519523 8031744: Annotations on many Language Model elements are not returned
jjg
parents: 29776
diff changeset
   288
            annotate.unblockAnnotations();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
            this.env = prevEnv;
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
    /** Visitor method: enter classes of a list of trees, returning a list of types.
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
    <T extends JCTree> List<Type> classEnter(List<T> trees, Env<AttrContext> env) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 20235
diff changeset
   296
        ListBuffer<Type> ts = new ListBuffer<>();
864
b1cf6afb8244 6724551: Use Queues instead of Lists to link compiler phases
jjg
parents: 10
diff changeset
   297
        for (List<T> l = trees; l.nonEmpty(); l = l.tail) {
b1cf6afb8244 6724551: Use Queues instead of Lists to link compiler phases
jjg
parents: 10
diff changeset
   298
            Type t = classEnter(l.head, env);
b1cf6afb8244 6724551: Use Queues instead of Lists to link compiler phases
jjg
parents: 10
diff changeset
   299
            if (t != null)
b1cf6afb8244 6724551: Use Queues instead of Lists to link compiler phases
jjg
parents: 10
diff changeset
   300
                ts.append(t);
b1cf6afb8244 6724551: Use Queues instead of Lists to link compiler phases
jjg
parents: 10
diff changeset
   301
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
        return ts.toList();
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
5008
3a90203fa91e 6930032: fix findbugs errors in com.sun.tools.javac.comp
jjg
parents: 4871
diff changeset
   305
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
    public void visitTopLevel(JCCompilationUnit tree) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   307
//        Assert.checkNonNull(tree.modle, tree.sourcefile.toString());
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   308
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
        JavaFileObject prev = log.useSource(tree.sourcefile);
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
        boolean addEnv = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
        boolean isPkgInfo = tree.sourcefile.isNameCompatible("package-info",
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
                                                             JavaFileObject.Kind.SOURCE);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   313
        if (TreeInfo.isModuleInfo(tree)) {
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   314
            JCPackageDecl pd = tree.getPackage();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   315
            if (pd != null) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   316
                log.error(pd.pos(), Errors.NoPkgInModuleInfoJava);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   317
            }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   318
            tree.packge = syms.rootPackage;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   319
            Env<AttrContext> topEnv = topLevelEnv(tree);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   320
            classEnter(tree.defs, topEnv);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   321
            tree.modle.usesProvidesCompleter = modules.getUsesProvidesCompleter();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   322
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   323
            JCPackageDecl pd = tree.getPackage();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   324
            if (pd != null) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   325
                tree.packge = pd.packge = syms.enterPackage(tree.modle, TreeInfo.fullName(pd.pid));
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   326
                if (   pd.annotations.nonEmpty()
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   327
                    || pkginfoOpt == PkgInfo.ALWAYS
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   328
                    || tree.docComments != null) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   329
                    if (isPkgInfo) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   330
                        addEnv = true;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   331
                    } else if (pd.annotations.nonEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   332
                        log.error(pd.annotations.head.pos(),
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   333
                                  "pkg.annotations.sb.in.package-info.java");
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   334
                    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
                }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   336
            } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   337
                tree.packge = tree.modle.unnamedPackage;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
            }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   339
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   340
            Map<Name, PackageSymbol> visiblePackages = tree.modle.visiblePackages;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   341
            Optional<ModuleSymbol> dependencyWithPackage =
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   342
                syms.listPackageModules(tree.packge.fullname)
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   343
                    .stream()
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   344
                    .filter(m -> m != tree.modle)
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   345
                    .filter(cand -> visiblePackages.get(tree.packge.fullname) == syms.getPackage(cand, tree.packge.fullname))
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   346
                    .findAny();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   348
            if (dependencyWithPackage.isPresent()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   349
                log.error(pd, Errors.PackageInOtherModule(dependencyWithPackage.get()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
            }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   351
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   352
            tree.packge.complete(); // Find all classes in package.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   353
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   354
            Env<AttrContext> topEnv = topLevelEnv(tree);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   355
            Env<AttrContext> packageEnv = isPkgInfo ? topEnv.dup(pd) : null;
4871
655bba719625 6499119: Created package-info class file modeled improperly
jjg
parents: 1264
diff changeset
   356
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   357
            // Save environment of package-info.java file.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   358
            if (isPkgInfo) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   359
                Env<AttrContext> env0 = typeEnvs.get(tree.packge);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   360
                if (env0 != null) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   361
                    JCCompilationUnit tree0 = env0.toplevel;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   362
                    if (!fileManager.isSameFile(tree.sourcefile, tree0.sourcefile)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   363
                        log.warning(pd != null ? pd.pid.pos() : null,
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   364
                                    "pkg-info.already.seen",
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   365
                                    tree.packge);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   366
                    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   367
                }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   368
                typeEnvs.put(tree.packge, packageEnv);
4871
655bba719625 6499119: Created package-info class file modeled improperly
jjg
parents: 1264
diff changeset
   369
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   370
                for (Symbol q = tree.packge; q != null && q.kind == PCK; q = q.owner)
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   371
                    q.flags_field |= EXISTS;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   372
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   373
                Name name = names.package_info;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   374
                ClassSymbol c = syms.enterClass(tree.modle, name, tree.packge);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   375
                c.flatname = names.fromString(tree.packge + "." + name);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   376
                c.sourcefile = tree.sourcefile;
30066
d74c06a92bd8 8078600: Infinite loop when compiling annotations with -XDcompletionDeps
alundblad
parents: 29842
diff changeset
   377
            c.completer = Completer.NULL_COMPLETER;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   378
                c.members_field = WriteableScope.create(c);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   379
                tree.packge.package_info = c;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   380
            }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   381
            classEnter(tree.defs, topEnv);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   382
            if (addEnv) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   383
                todo.append(packageEnv);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   384
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
        log.useSource(prev);
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
        result = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
5008
3a90203fa91e 6930032: fix findbugs errors in com.sun.tools.javac.comp
jjg
parents: 4871
diff changeset
   390
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
    public void visitClassDef(JCClassDecl tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
        Symbol owner = env.info.scope.owner;
25443
9187d77f2c64 8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents: 25007
diff changeset
   393
        WriteableScope enclScope = enterScope(env);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
        ClassSymbol c;
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
        if (owner.kind == PCK) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
            // We are seeing a toplevel class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
            PackageSymbol packge = (PackageSymbol)owner;
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
            for (Symbol q = packge; q != null && q.kind == PCK; q = q.owner)
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
                q.flags_field |= EXISTS;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   400
            c = syms.enterClass(env.toplevel.modle, tree.name, packge);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
            packge.members().enterIfAbsent(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
            if ((tree.mods.flags & PUBLIC) != 0 && !classNameMatchesFileName(c, env)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
                log.error(tree.pos(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
                          "class.public.should.be.in.file", tree.name);
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
        } else {
1260
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents: 1257
diff changeset
   407
            if (!tree.name.isEmpty() &&
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
                !chk.checkUniqueClassName(tree.pos(), tree.name, enclScope)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
                result = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
                return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
            if (owner.kind == TYP) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
                // We are seeing a member class.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   414
                c = syms.enterClass(env.toplevel.modle, tree.name, (TypeSymbol)owner);
42411
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   415
                if (c.owner != owner) {
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   416
                    //anonymous class loaded from a classfile may be recreated from source (see below)
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   417
                    //if this class is a member of such an anonymous class, fix the owner:
42827
36468b5fa7f4 8181370: Convert anonymous inner classes into lambdas/method references
mcimadamore
parents: 42411
diff changeset
   418
                    Assert.check(owner.owner.kind != TYP, owner::toString);
42411
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   419
                    Assert.check(c.owner.kind == TYP, () -> c.owner.toString());
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   420
                    ClassSymbol cowner = (ClassSymbol) c.owner;
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   421
                    if (cowner.members_field != null) {
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   422
                        cowner.members_field.remove(c);
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   423
                    }
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   424
                    c.owner = owner;
2433ceacb13e 8166628: Compiling with annotation processing, access error in specific situation
jlahoda
parents: 42407
diff changeset
   425
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
                if ((owner.flags_field & INTERFACE) != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
                    tree.mods.flags |= PUBLIC | STATIC;
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
                // We are seeing a local class.
22442
8fd30fc4e3a3 8029690: Move symbol creation from ClassReader to Symtab
jfranck
parents: 22163
diff changeset
   431
                c = syms.defineClass(tree.name, owner);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
                c.flatname = chk.localClassName(c);
1260
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents: 1257
diff changeset
   433
                if (!c.name.isEmpty())
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
                    chk.checkTransparentClass(tree.pos(), c, env.info.scope);
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
        tree.sym = c;
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
        // Enter class into `compiled' table and enclosing scope.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   440
        if (chk.getCompiled(c) != null) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
            duplicateClass(tree.pos(), c);
1257
873b053bf757 6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents: 1206
diff changeset
   442
            result = types.createErrorType(tree.name, (TypeSymbol)owner, Type.noType);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
            tree.sym = (ClassSymbol)result.tsym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
        }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   446
        chk.putCompiled(c);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
        enclScope.enter(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
        // Set up an environment for class block and store in `typeEnvs'
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
        // table, to be retrieved later in memberEnter and attribution.
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
        Env<AttrContext> localEnv = classEnv(tree, env);
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
        typeEnvs.put(c, localEnv);
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
        // Fill out class fields.
30066
d74c06a92bd8 8078600: Infinite loop when compiling annotations with -XDcompletionDeps
alundblad
parents: 29842
diff changeset
   455
        c.completer = Completer.NULL_COMPLETER; // do not allow the initial completer linger on.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
        c.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, c, tree);
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
        c.sourcefile = env.toplevel.sourcefile;
25443
9187d77f2c64 8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents: 25007
diff changeset
   458
        c.members_field = WriteableScope.create(c);
39372
a42db8c180c3 8132446: AsssertionError in ClassSymbol.setAnnotationType
sadayapalam
parents: 36526
diff changeset
   459
        c.clearAnnotationMetadata();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
        ClassType ct = (ClassType)c.type;
06bc494ca11e Initial load
duke
parents:
diff changeset
   462
        if (owner.kind != PCK && (c.flags_field & STATIC) == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
            // We are seeing a local or inner class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
            // Set outer_field of this class to closest enclosing class
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
            // which contains this class in a non-static context
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
            // (its "enclosing instance class"), provided such a class exists.
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
            Symbol owner1 = owner;
27224
228abfa87080 8054457: Refactor Symbol kinds from small ints to an enum
emc
parents: 25874
diff changeset
   468
            while (owner1.kind.matches(KindSelector.VAL_MTH) &&
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
                   (owner1.flags_field & STATIC) == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
                owner1 = owner1.owner;
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
            if (owner1.kind == TYP) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
                ct.setEnclosingType(owner1.type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
        // Enter type parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
        ct.typarams_field = classEnter(tree.typarams, localEnv);
39372
a42db8c180c3 8132446: AsssertionError in ClassSymbol.setAnnotationType
sadayapalam
parents: 36526
diff changeset
   479
        ct.allparams_field = null;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
28589
cbf8df194957 8052070: javac crashes when there are duplicated type parameters
jlahoda
parents: 27857
diff changeset
   481
        // install further completer for this type.
cbf8df194957 8052070: javac crashes when there are duplicated type parameters
jlahoda
parents: 27857
diff changeset
   482
        c.completer = typeEnter;
cbf8df194957 8052070: javac crashes when there are duplicated type parameters
jlahoda
parents: 27857
diff changeset
   483
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
        // Add non-local class to uncompleted, to make sure it will be
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
        // completed later.
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
        if (!c.isLocal() && uncompleted != null) uncompleted.append(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
//      System.err.println("entering " + c.fullname + " in " + c.owner);//DEBUG
06bc494ca11e Initial load
duke
parents:
diff changeset
   488
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
        // Recursively enter all member classes.
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
        classEnter(tree.defs, localEnv);
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   492
//        Assert.checkNonNull(c.modle, c.sourcefile.toString());
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   493
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
        result = c.type;
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   496
    //where
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
        /** Does class have the same name as the file it appears in?
06bc494ca11e Initial load
duke
parents:
diff changeset
   498
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
        private static boolean classNameMatchesFileName(ClassSymbol c,
06bc494ca11e Initial load
duke
parents:
diff changeset
   500
                                                        Env<AttrContext> env) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   501
            return env.toplevel.sourcefile.isNameCompatible(c.name.toString(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   502
                                                            JavaFileObject.Kind.SOURCE);
06bc494ca11e Initial load
duke
parents:
diff changeset
   503
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   504
06bc494ca11e Initial load
duke
parents:
diff changeset
   505
    /** Complain about a duplicate class. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   506
    protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
        log.error(pos, "duplicate.class", c.fullname);
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
06bc494ca11e Initial load
duke
parents:
diff changeset
   510
    /** Class enter visitor method for type parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
     *  Enter a symbol for type parameter in local scope, after checking that it
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
     *  is unique.
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
     */
5008
3a90203fa91e 6930032: fix findbugs errors in com.sun.tools.javac.comp
jjg
parents: 4871
diff changeset
   514
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
    public void visitTypeParameter(JCTypeParameter tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   516
        TypeVar a = (tree.type != null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   517
            ? (TypeVar)tree.type
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
            : new TypeVar(tree.name, env.info.scope.owner, syms.botType);
06bc494ca11e Initial load
duke
parents:
diff changeset
   519
        tree.type = a;
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
        if (chk.checkUnique(tree.pos(), a.tsym, env.info.scope)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
            env.info.scope.enter(a.tsym);
06bc494ca11e Initial load
duke
parents:
diff changeset
   522
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
        result = a;
06bc494ca11e Initial load
duke
parents:
diff changeset
   524
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   525
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   526
    @Override
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   527
    public void visitModuleDef(JCModuleDecl tree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   528
        Env<AttrContext> moduleEnv = moduleEnv(tree, env);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   529
        typeEnvs.put(tree.sym, moduleEnv);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   530
        if (modules.isInModuleGraph(tree.sym)) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   531
            todo.append(moduleEnv);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   532
        }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   533
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30066
diff changeset
   534
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
    /** Default class enter visitor method: do nothing.
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
     */
5008
3a90203fa91e 6930032: fix findbugs errors in com.sun.tools.javac.comp
jjg
parents: 4871
diff changeset
   537
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
    public void visitTree(JCTree tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   539
        result = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   540
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   541
06bc494ca11e Initial load
duke
parents:
diff changeset
   542
    /** Main method: enter all classes in a list of toplevel trees.
06bc494ca11e Initial load
duke
parents:
diff changeset
   543
     *  @param trees      The list of trees to be processed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   544
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   545
    public void main(List<JCCompilationUnit> trees) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   546
        complete(trees, null);
06bc494ca11e Initial load
duke
parents:
diff changeset
   547
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   548
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
   549
    /** Main method: enter classes from the list of toplevel trees, possibly
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
   550
     *  skipping TypeEnter for all but 'c' by placing them on the uncompleted
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
   551
     *  list.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   552
     *  @param trees      The list of trees to be processed.
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
   553
     *  @param c          The class symbol to be processed or null to process all.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   554
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   555
    public void complete(List<JCCompilationUnit> trees, ClassSymbol c) {
29842
826ac2519523 8031744: Annotations on many Language Model elements are not returned
jjg
parents: 29776
diff changeset
   556
        annotate.blockAnnotations();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   557
        ListBuffer<ClassSymbol> prevUncompleted = uncompleted;
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
   558
        if (typeEnter.completionEnabled) uncompleted = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   559
06bc494ca11e Initial load
duke
parents:
diff changeset
   560
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   561
            // enter all classes, and construct uncompleted list
06bc494ca11e Initial load
duke
parents:
diff changeset
   562
            classEnter(trees, null);
06bc494ca11e Initial load
duke
parents:
diff changeset
   563
06bc494ca11e Initial load
duke
parents:
diff changeset
   564
            // complete all uncompleted classes in memberEnter
27857
7e913a535736 7101822: Compiling depends on order of imports
jlahoda
parents: 27224
diff changeset
   565
            if (typeEnter.completionEnabled) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   566
                while (uncompleted.nonEmpty()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   567
                    ClassSymbol clazz = uncompleted.next();
06bc494ca11e Initial load
duke
parents:
diff changeset
   568
                    if (c == null || c == clazz || prevUncompleted == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   569
                        clazz.complete();
06bc494ca11e Initial load
duke
parents:
diff changeset
   570
                    else
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
                        // defer
06bc494ca11e Initial load
duke
parents:
diff changeset
   572
                        prevUncompleted.append(clazz);
06bc494ca11e Initial load
duke
parents:
diff changeset
   573
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   574
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   575
                if (!modules.modulesInitialized()) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   576
                    for (JCCompilationUnit cut : trees) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   577
                        if (cut.getModuleDecl() != null) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   578
                            unfinishedModules.append(cut);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   579
                        } else {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   580
                            typeEnter.ensureImportsChecked(List.of(cut));
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   581
                        }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   582
                    }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   583
                } else {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   584
                    typeEnter.ensureImportsChecked(unfinishedModules.toList());
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   585
                    unfinishedModules.clear();
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   586
                    typeEnter.ensureImportsChecked(trees);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 39372
diff changeset
   587
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   588
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   589
        } finally {
06bc494ca11e Initial load
duke
parents:
diff changeset
   590
            uncompleted = prevUncompleted;
29842
826ac2519523 8031744: Annotations on many Language Model elements are not returned
jjg
parents: 29776
diff changeset
   591
            annotate.unblockAnnotations();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   592
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   593
    }
23810
b92eb80925f0 8038455: Use single Context for all rounds of annotation processing
jlahoda
parents: 22442
diff changeset
   594
b92eb80925f0 8038455: Use single Context for all rounds of annotation processing
jlahoda
parents: 22442
diff changeset
   595
    public void newRound() {
b92eb80925f0 8038455: Use single Context for all rounds of annotation processing
jlahoda
parents: 22442
diff changeset
   596
        typeEnvs.clear();
b92eb80925f0 8038455: Use single Context for all rounds of annotation processing
jlahoda
parents: 22442
diff changeset
   597
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   598
}