67 import com.sun.tools.javac.util.Abort; |
67 import com.sun.tools.javac.util.Abort; |
68 import com.sun.tools.javac.util.Context; |
68 import com.sun.tools.javac.util.Context; |
69 import com.sun.tools.javac.util.List; |
69 import com.sun.tools.javac.util.List; |
70 import com.sun.tools.javac.util.ListBuffer; |
70 import com.sun.tools.javac.util.ListBuffer; |
71 import com.sun.tools.javac.util.Log; |
71 import com.sun.tools.javac.util.Log; |
|
72 import com.sun.tools.javac.util.JavacMessages; |
72 import com.sun.tools.javac.util.Name; |
73 import com.sun.tools.javac.util.Name; |
73 import com.sun.tools.javac.util.Names; |
74 import com.sun.tools.javac.util.Names; |
74 import com.sun.tools.javac.util.Options; |
75 import com.sun.tools.javac.util.Options; |
75 |
76 |
76 import static javax.tools.StandardLocation.*; |
77 import static javax.tools.StandardLocation.*; |
131 /** |
132 /** |
132 * Source level of the compile. |
133 * Source level of the compile. |
133 */ |
134 */ |
134 Source source; |
135 Source source; |
135 |
136 |
|
137 /** |
|
138 * JavacMessages object used for localization |
|
139 */ |
|
140 private JavacMessages messages; |
|
141 |
136 private Context context; |
142 private Context context; |
137 |
143 |
138 public JavacProcessingEnvironment(Context context, Iterable<? extends Processor> processors) { |
144 public JavacProcessingEnvironment(Context context, Iterable<? extends Processor> processors) { |
139 options = Options.instance(context); |
145 options = Options.instance(context); |
140 this.context = context; |
146 this.context = context; |
141 log = Log.instance(context); |
147 log = Log.instance(context); |
142 source = Source.instance(context); |
148 source = Source.instance(context); |
143 printProcessorInfo = options.get("-XprintProcessorInfo") != null; |
149 printProcessorInfo = options.get("-XprintProcessorInfo") != null; |
155 messager = new JavacMessager(context, this); |
161 messager = new JavacMessager(context, this); |
156 elementUtils = new JavacElements(context); |
162 elementUtils = new JavacElements(context); |
157 typeUtils = new JavacTypes(context); |
163 typeUtils = new JavacTypes(context); |
158 processorOptions = initProcessorOptions(context); |
164 processorOptions = initProcessorOptions(context); |
159 unmatchedProcessorOptions = initUnmatchedProcessorOptions(); |
165 unmatchedProcessorOptions = initUnmatchedProcessorOptions(); |
|
166 messages = JavacMessages.instance(context); |
160 initProcessorIterator(context, processors); |
167 initProcessorIterator(context, processors); |
161 } |
168 } |
162 |
169 |
163 private Set<String> initPlatformAnnotations() { |
170 private Set<String> initPlatformAnnotations() { |
164 Set<String> platformAnnotations = new HashSet<String>(); |
171 Set<String> platformAnnotations = new HashSet<String>(); |
1244 public SourceVersion getSourceVersion() { |
1251 public SourceVersion getSourceVersion() { |
1245 return Source.toSourceVersion(source); |
1252 return Source.toSourceVersion(source); |
1246 } |
1253 } |
1247 |
1254 |
1248 public Locale getLocale() { |
1255 public Locale getLocale() { |
1249 return Locale.getDefault(); |
1256 return messages.getCurrentLocale(); |
1250 } |
1257 } |
1251 |
1258 |
1252 public Set<Symbol.PackageSymbol> getSpecifiedPackages() { |
1259 public Set<Symbol.PackageSymbol> getSpecifiedPackages() { |
1253 return specifiedPackages; |
1260 return specifiedPackages; |
1254 } |
1261 } |