1.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Aug 20 17:21:47 2013 +0200 1.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Aug 20 12:15:19 2013 -0700 1.3 @@ -363,6 +363,7 @@ 1.4 throw new Abort(); 1.5 } 1.6 source = Source.instance(context); 1.7 + Target target = Target.instance(context); 1.8 attr = Attr.instance(context); 1.9 chk = Check.instance(context); 1.10 gen = Gen.instance(context); 1.11 @@ -403,6 +404,8 @@ 1.12 } 1.13 } 1.14 1.15 + checkForObsoleteOptions(target); 1.16 + 1.17 verboseCompilePolicy = options.isSet("verboseCompilePolicy"); 1.18 1.19 if (attrParseOnly) 1.20 @@ -432,6 +435,26 @@ 1.21 log.setDiagnosticFormatter(RichDiagnosticFormatter.instance(context)); 1.22 } 1.23 1.24 + private void checkForObsoleteOptions(Target target) { 1.25 + // Unless lint checking on options is disabled, check for 1.26 + // obsolete source and target options. 1.27 + boolean obsoleteOptionFound = false; 1.28 + if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) { 1.29 + if (source.compareTo(Source.JDK1_5) <= 0) { 1.30 + log.warning(LintCategory.OPTIONS, "option.obsolete.source", source.name); 1.31 + obsoleteOptionFound = true; 1.32 + } 1.33 + 1.34 + if (target.compareTo(Target.JDK1_5) <= 0) { 1.35 + log.warning(LintCategory.OPTIONS, "option.obsolete.target", source.name); 1.36 + obsoleteOptionFound = true; 1.37 + } 1.38 + 1.39 + if (obsoleteOptionFound) 1.40 + log.warning(LintCategory.OPTIONS, "option.obsolete.suppression"); 1.41 + } 1.42 + } 1.43 + 1.44 /* Switches: 1.45 */ 1.46