src/share/classes/com/sun/tools/apt/mirror/util/TypesImpl.java

Print this page




  27 
  28 
  29 import java.util.Collection;
  30 
  31 import com.sun.mirror.declaration.*;
  32 import com.sun.mirror.type.*;
  33 import com.sun.mirror.util.Types;
  34 import com.sun.tools.apt.mirror.AptEnv;
  35 import com.sun.tools.apt.mirror.declaration.*;
  36 import com.sun.tools.apt.mirror.type.TypeMirrorImpl;
  37 import com.sun.tools.javac.code.BoundKind;
  38 import com.sun.tools.javac.code.Type;
  39 import com.sun.tools.javac.code.Symbol.ClassSymbol;
  40 import com.sun.tools.javac.util.Context;
  41 import com.sun.tools.javac.util.ListBuffer;
  42 
  43 
  44 /**
  45  * Implementation of Types utility methods for annotation processors
  46  */
  47 
  48 public class TypesImpl implements Types {
  49 
  50     private final AptEnv env;
  51 
  52 
  53     private static final Context.Key<Types> typesKey =
  54             new Context.Key<Types>();
  55 
  56     public static Types instance(Context context) {
  57         Types instance = context.get(typesKey);
  58         if (instance == null) {
  59             instance = new TypesImpl(context);
  60         }
  61         return instance;
  62     }
  63 
  64     private TypesImpl(Context context) {
  65         context.put(typesKey, this);
  66         env = AptEnv.instance(context);
  67     }




  27 
  28 
  29 import java.util.Collection;
  30 
  31 import com.sun.mirror.declaration.*;
  32 import com.sun.mirror.type.*;
  33 import com.sun.mirror.util.Types;
  34 import com.sun.tools.apt.mirror.AptEnv;
  35 import com.sun.tools.apt.mirror.declaration.*;
  36 import com.sun.tools.apt.mirror.type.TypeMirrorImpl;
  37 import com.sun.tools.javac.code.BoundKind;
  38 import com.sun.tools.javac.code.Type;
  39 import com.sun.tools.javac.code.Symbol.ClassSymbol;
  40 import com.sun.tools.javac.util.Context;
  41 import com.sun.tools.javac.util.ListBuffer;
  42 
  43 
  44 /**
  45  * Implementation of Types utility methods for annotation processors
  46  */
  47 @SuppressWarnings("deprecation")
  48 public class TypesImpl implements Types {
  49 
  50     private final AptEnv env;
  51 
  52 
  53     private static final Context.Key<Types> typesKey =
  54             new Context.Key<Types>();
  55 
  56     public static Types instance(Context context) {
  57         Types instance = context.get(typesKey);
  58         if (instance == null) {
  59             instance = new TypesImpl(context);
  60         }
  61         return instance;
  62     }
  63 
  64     private TypesImpl(Context context) {
  65         context.put(typesKey, this);
  66         env = AptEnv.instance(context);
  67     }