@@ -290,12 +290,21 @@ public static String[] buildCompilerArguments( CompilerConfiguration config, Str
290290                args .add ( buffer .toString () );
291291            }
292292            if  ( config .getProcessorPathEntries () != null  && !config .getProcessorPathEntries ().isEmpty () ) {
293-                 args .add ( "-processorpath"  );
294293
294+                 if (!isPreJava9 (config ) && Arrays .asList (sourceFiles ).contains ("module-info.java" )){
295+                     args .add ( "--processor-module-path"  );
296+ 
297+                 } else  {
298+                     args .add ( "-processorpath"  );
299+ 
300+                 }
295301                args .add ( getPathString ( config .getProcessorPathEntries () ) );
296302            }
303+ 
297304        }
298305
306+ 
307+ 
299308        if  ( config .isOptimize () )
300309        {
301310            args .add ( "-O"  );
@@ -439,29 +448,59 @@ private static boolean isPreJava14( CompilerConfiguration config )
439448     */ 
440449    private  static  boolean  isPreJava16 ( CompilerConfiguration  config  )
441450    {
442-         String  v  = config .getCompilerVersion ();
451+         String  v  = config .getReleaseVersion ();
443452
444453        if  ( v  == null  )
445454        {
446-             //mkleint: i haven't completely understood the reason for the 
447-             //compiler version parameter, checking source as well, as most projects will have this one set, not the compiler 
448-             String  s  = config .getSourceVersion ();
449-             if  ( s  == null  )
450-             {
451-                 //now return true, as the 1.6 version is not the default - 1.4 is. 
452-                 return  true ;
453-             }
454-             return  s .startsWith ( "1.5"  ) || s .startsWith ( "1.4"  ) || s .startsWith ( "1.3"  ) || s .startsWith ( "1.2"  )
455-                 || s .startsWith ( "1.1"  ) || s .startsWith ( "1.0"  );
455+             v  = config .getCompilerVersion ();
456456        }
457457
458-         return  v .startsWith ( "1.5"  ) || v .startsWith ( "1.4"  ) || v .startsWith ( "1.3"  ) || v .startsWith ( "1.2"  )
458+         if  ( v  == null  )
459+         {
460+             v  = config .getSourceVersion ();
461+         }
462+ 
463+         if  ( v  == null  )
464+         {
465+             return  true ;
466+         }
467+ 
468+         return  v .startsWith ( "5"  ) || v .startsWith ( "1.5"  ) || v .startsWith ( "1.4"  ) || v .startsWith ( "1.3"  ) || v .startsWith ( "1.2"  )
459469            || v .startsWith ( "1.1"  ) || v .startsWith ( "1.0"  );
460470    }
461471
462472    private  static  boolean  isPreJava18 ( CompilerConfiguration  config  )
463473    {
464-         String  v  = config .getCompilerVersion ();
474+         String  v  = config .getReleaseVersion ();
475+ 
476+         if  ( v  == null  )
477+         {
478+             v  = config .getCompilerVersion ();
479+         }
480+ 
481+         if  ( v  == null  )
482+         {
483+             v  = config .getSourceVersion ();
484+         }
485+ 
486+         if  ( v  == null  )
487+         {
488+             return  true ;
489+         }
490+ 
491+         return  v .startsWith ( "7"  ) || v .startsWith ( "1.7"  ) || v .startsWith ( "6"  ) ||v .startsWith ( "1.6"  ) || v .startsWith ( "1.5"  ) || v .startsWith ( "1.4"  )
492+                 || v .startsWith ( "1.3"  ) || v .startsWith ( "1.2"  ) || v .startsWith ( "1.1"  ) || v .startsWith ( "1.0"  );
493+     }
494+ 
495+     private  static  boolean  isPreJava9 ( CompilerConfiguration  config  )
496+     {
497+ 
498+         String  v  = config .getReleaseVersion ();
499+ 
500+         if  ( v  == null  )
501+         {
502+             v  = config .getCompilerVersion ();
503+         }
465504
466505        if  ( v  == null  )
467506        {
@@ -473,7 +512,7 @@ private static boolean isPreJava18( CompilerConfiguration config )
473512            return  true ;
474513        }
475514
476-         return  v .startsWith ( "1.7"  ) || v .startsWith ( "1.6"  ) || v .startsWith ( "1.5"  ) || v .startsWith ( "1.4"  )
515+         return  v .startsWith ( "8"   )  ||  v . startsWith (  "1.8"  )  ||  v . startsWith (  "7"  ) ||  v . startsWith (  " 1.7"v .startsWith ( "1.6"  ) || v .startsWith ( "1.5"  ) || v .startsWith ( "1.4"  )
477516                || v .startsWith ( "1.3"  ) || v .startsWith ( "1.2"  ) || v .startsWith ( "1.1"  ) || v .startsWith ( "1.0"  );
478517    }
479518
0 commit comments