src/share/classes/com/sun/tools/apt/mirror/apt/MessagerImpl.java

Print this page




  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package com.sun.tools.apt.mirror.apt;
  27 
  28 import javax.tools.JavaFileObject;
  29 import com.sun.mirror.apt.Messager;
  30 import com.sun.tools.apt.mirror.util.SourcePositionImpl;
  31 import com.sun.mirror.util.SourcePosition;
  32 import com.sun.tools.javac.util.Context;
  33 import com.sun.tools.javac.util.Name;
  34 import com.sun.tools.javac.util.Position;
  35 import com.sun.tools.apt.util.Bark;
  36 
  37 
  38 /**
  39  * Implementation of Messager.
  40  */
  41 
  42 public class MessagerImpl implements Messager {
  43     private final Bark bark;
  44 
  45     private static final Context.Key<MessagerImpl> messagerKey =
  46             new Context.Key<MessagerImpl>();
  47 
  48     public static MessagerImpl instance(Context context) {
  49         MessagerImpl instance = context.get(messagerKey);
  50         if (instance == null) {
  51             instance = new MessagerImpl(context);
  52         }
  53         return instance;
  54     }
  55 
  56     private MessagerImpl(Context context) {
  57         context.put(messagerKey, this);
  58         bark = Bark.instance(context);
  59     }
  60 
  61 




  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package com.sun.tools.apt.mirror.apt;
  27 
  28 import javax.tools.JavaFileObject;
  29 import com.sun.mirror.apt.Messager;
  30 import com.sun.tools.apt.mirror.util.SourcePositionImpl;
  31 import com.sun.mirror.util.SourcePosition;
  32 import com.sun.tools.javac.util.Context;
  33 import com.sun.tools.javac.util.Name;
  34 import com.sun.tools.javac.util.Position;
  35 import com.sun.tools.apt.util.Bark;
  36 
  37 
  38 /**
  39  * Implementation of Messager.
  40  */
  41 @SuppressWarnings("deprecation")
  42 public class MessagerImpl implements Messager {
  43     private final Bark bark;
  44 
  45     private static final Context.Key<MessagerImpl> messagerKey =
  46             new Context.Key<MessagerImpl>();
  47 
  48     public static MessagerImpl instance(Context context) {
  49         MessagerImpl instance = context.get(messagerKey);
  50         if (instance == null) {
  51             instance = new MessagerImpl(context);
  52         }
  53         return instance;
  54     }
  55 
  56     private MessagerImpl(Context context) {
  57         context.put(messagerKey, this);
  58         bark = Bark.instance(context);
  59     }
  60 
  61