langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
changeset 45504 ea7475564d07
parent 44291 e1b620ac6c98
child 45744 db6aedca2c8c
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jun 14 20:05:01 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Jun 15 13:44:42 2017 +0200
@@ -69,6 +69,7 @@
 import com.sun.tools.javac.platform.PlatformDescription;
 import com.sun.tools.javac.platform.PlatformDescription.PluginInfo;
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.Abort;
@@ -412,7 +413,7 @@
                     this.iterator = handleServiceLoaderUnavailability("proc.no.service", null);
                 }
             } catch (Throwable t) {
-                log.error("proc.service.problem");
+                log.error(Errors.ProcServiceProblem);
                 throw new Abort(t);
             }
         }
@@ -428,7 +429,7 @@
             try {
                 return internalHasNext();
             } catch(ServiceConfigurationError sce) {
-                log.error("proc.bad.config.file", sce.getLocalizedMessage());
+                log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
                 throw new Abort(sce);
             } catch (Throwable t) {
                 throw new Abort(t);
@@ -444,7 +445,7 @@
             try {
                 return internalNext();
             } catch (ServiceConfigurationError sce) {
-                log.error("proc.bad.config.file", sce.getLocalizedMessage());
+                log.error(Errors.ProcBadConfigFile(sce.getLocalizedMessage()));
                 throw new Abort(sce);
             } catch (Throwable t) {
                 throw new Abort(t);
@@ -561,13 +562,13 @@
                     ensureReadable(processorClass);
                     return (Processor) processorClass.getConstructor().newInstance();
                 } catch (ClassNotFoundException cnfe) {
-                    log.error("proc.processor.not.found", processorName);
+                    log.error(Errors.ProcProcessorNotFound(processorName));
                     return null;
                 } catch (ClassCastException cce) {
-                    log.error("proc.processor.wrong.type", processorName);
+                    log.error(Errors.ProcProcessorWrongType(processorName));
                     return null;
                 } catch (Exception e ) {
-                    log.error("proc.processor.cant.instantiate", processorName);
+                    log.error(Errors.ProcProcessorCantInstantiate(processorName));
                     return null;
                 }
             } catch (ClientCodeException e) {
@@ -707,19 +708,17 @@
             SourceVersion procSourceVersion = processor.getSupportedSourceVersion();
 
             if (procSourceVersion.compareTo(Source.toSourceVersion(source)) < 0 )  {
-                log.warning("proc.processor.incompatible.source.version",
-                            procSourceVersion,
-                            processor.getClass().getName(),
-                            source.name);
+                log.warning(Warnings.ProcProcessorIncompatibleSourceVersion(procSourceVersion,
+                                                                            processor.getClass().getName(),
+                                                                            source.name));
             }
         }
 
         private boolean checkOptionName(String optionName, Log log) {
             boolean valid = isValidOptionName(optionName);
             if (!valid)
-                log.error("proc.processor.bad.option.name",
-                            optionName,
-                            processor.getClass().getName());
+                log.error(Errors.ProcProcessorBadOptionName(optionName,
+                                                            processor.getClass().getName()));
             return valid;
         }
 
@@ -904,8 +903,7 @@
             // Remove annotations processed by javac
             unmatchedAnnotations.keySet().removeAll(platformAnnotations);
             if (unmatchedAnnotations.size() > 0) {
-                log.warning("proc.annotations.without.processors",
-                            unmatchedAnnotations.keySet());
+                log.warning(Warnings.ProcAnnotationsWithoutProcessors(unmatchedAnnotations.keySet()));
             }
         }
 
@@ -967,12 +965,12 @@
         try {
             return proc.process(tes, renv);
         } catch (ClassFinder.BadClassFile ex) {
-            log.error("proc.cant.access.1", ex.sym, ex.getDetailValue());
+            log.error(Errors.ProcCantAccess1(ex.sym, ex.getDetailValue()));
             return false;
         } catch (CompletionFailure ex) {
             StringWriter out = new StringWriter();
             ex.printStackTrace(new PrintWriter(out));
-            log.error("proc.cant.access", ex.sym, ex.getDetailValue(), out.toString());
+            log.error(Errors.ProcCantAccess(ex.sym, ex.getDetailValue(), out.toString()));
             return false;
         } catch (ClientCodeException e) {
             throw e;
@@ -1385,7 +1383,7 @@
 
     private void warnIfUnmatchedOptions() {
         if (!unmatchedProcessorOptions.isEmpty()) {
-            log.warning("proc.unmatched.processor.options", unmatchedProcessorOptions.toString());
+            log.warning(Warnings.ProcUnmatchedProcessorOptions(unmatchedProcessorOptions.toString()));
         }
     }
 
@@ -1490,7 +1488,7 @@
                 throw new AssertionError(ex);
             }
             catch (ServiceProxy.ServiceConfigurationError e) {
-                log.error("proc.bad.config.file", e.getLocalizedMessage());
+                log.error(Errors.ProcBadConfigFile(e.getLocalizedMessage()));
                 return true;
             }
         }
@@ -1682,7 +1680,7 @@
         if (MatchingUtils.isValidImportString(pkg)) {
             return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg));
         } else {
-            log.warning("proc.malformed.supported.string", s, p.getClass().getName());
+            log.warning(Warnings.ProcMalformedSupportedString(s, p.getClass().getName()));
             return noMatches; // won't match any valid identifier
         }
     }