|
62 | 62 | import com.sun.tools.javac.platform.PlatformDescription;
|
63 | 63 | import com.sun.tools.javac.platform.PlatformUtils;
|
64 | 64 | import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
| 65 | +import com.sun.tools.javac.resources.CompilerProperties.Fragments; |
65 | 66 | import com.sun.tools.javac.resources.CompilerProperties.Warnings;
|
66 | 67 | import com.sun.tools.javac.util.Context;
|
67 | 68 | import com.sun.tools.javac.util.JCDiagnostic;
|
68 | 69 | import com.sun.tools.javac.util.JCDiagnostic.DiagnosticInfo;
|
| 70 | +import com.sun.tools.javac.util.JCDiagnostic.Fragment; |
69 | 71 | import com.sun.tools.javac.util.List;
|
70 | 72 | import com.sun.tools.javac.util.ListBuffer;
|
71 | 73 | import com.sun.tools.javac.util.Log;
|
@@ -521,9 +523,9 @@ public boolean validate() {
|
521 | 523 | if (target.compareTo(source.requiredTarget()) < 0) {
|
522 | 524 | if (targetString != null) {
|
523 | 525 | if (sourceString == null) {
|
524 |
| - reportDiag(Warnings.TargetDefaultSourceConflict(targetString, source.requiredTarget())); |
| 526 | + reportDiag(Errors.TargetDefaultSourceConflict(source.name, targetString)); |
525 | 527 | } else {
|
526 |
| - reportDiag(Warnings.SourceTargetConflict(sourceString, source.requiredTarget())); |
| 528 | + reportDiag(Errors.SourceTargetConflict(sourceString, targetString)); |
527 | 529 | }
|
528 | 530 | return false;
|
529 | 531 | } else {
|
@@ -569,10 +571,10 @@ public boolean validate() {
|
569 | 571 | if (fm instanceof BaseFileManager baseFileManager) {
|
570 | 572 | if (source.compareTo(Source.JDK8) <= 0) {
|
571 | 573 | if (baseFileManager.isDefaultBootClassPath())
|
572 |
| - log.warning(LintCategory.OPTIONS, Warnings.SourceNoBootclasspath(source.name)); |
| 574 | + log.warning(LintCategory.OPTIONS, Warnings.SourceNoBootclasspath(source.name, releaseNote(source, targetString))); |
573 | 575 | } else {
|
574 | 576 | if (baseFileManager.isDefaultSystemModulesPath())
|
575 |
| - log.warning(LintCategory.OPTIONS, Warnings.SourceNoSystemModulesPath(source.name)); |
| 577 | + log.warning(LintCategory.OPTIONS, Warnings.SourceNoSystemModulesPath(source.name, releaseNote(source, targetString))); |
576 | 578 | }
|
577 | 579 | }
|
578 | 580 | }
|
@@ -640,6 +642,22 @@ public boolean validate() {
|
640 | 642 | return !errors && (log.nerrors == 0);
|
641 | 643 | }
|
642 | 644 |
|
| 645 | + private Fragment releaseNote(Source source, String targetString) { |
| 646 | + if (source.compareTo(Source.JDK8) <= 0) { |
| 647 | + if (targetString != null) { |
| 648 | + return Fragments.SourceNoBootclasspathWithTarget(source.name, targetString); |
| 649 | + } else { |
| 650 | + return Fragments.SourceNoBootclasspath(source.name); |
| 651 | + } |
| 652 | + } else { |
| 653 | + if (targetString != null) { |
| 654 | + return Fragments.SourceNoSystemModulesPathWithTarget(source.name, targetString); |
| 655 | + } else { |
| 656 | + return Fragments.SourceNoSystemModulesPath(source.name); |
| 657 | + } |
| 658 | + } |
| 659 | + } |
| 660 | + |
643 | 661 | private void validateAddExports(SourceVersion sv) {
|
644 | 662 | String addExports = options.get(Option.ADD_EXPORTS);
|
645 | 663 | if (addExports != null) {
|
|
0 commit comments