23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.javac.main; |
26 package com.sun.tools.javac.main; |
27 |
27 |
28 import com.sun.tools.javac.code.Lint; |
|
29 import com.sun.tools.javac.code.Source; |
|
30 import com.sun.tools.javac.code.Type; |
|
31 import com.sun.tools.javac.jvm.Target; |
|
32 import com.sun.tools.javac.main.JavacOption.HiddenOption; |
|
33 import com.sun.tools.javac.main.JavacOption.Option; |
|
34 import com.sun.tools.javac.main.JavacOption.XOption; |
|
35 import com.sun.tools.javac.util.ListBuffer; |
|
36 import com.sun.tools.javac.util.Options; |
|
37 import com.sun.tools.javac.processing.JavacProcessingEnvironment; |
|
38 import java.io.File; |
28 import java.io.File; |
39 import java.io.FileWriter; |
29 import java.io.FileWriter; |
40 import java.io.PrintWriter; |
30 import java.io.PrintWriter; |
41 import java.util.EnumSet; |
31 import java.util.EnumSet; |
42 import java.util.LinkedHashMap; |
32 import java.util.LinkedHashMap; |
43 import java.util.Map; |
33 import java.util.Map; |
44 import java.util.Set; |
34 import java.util.Set; |
45 import javax.lang.model.SourceVersion; |
35 import javax.lang.model.SourceVersion; |
|
36 |
|
37 import com.sun.tools.javac.code.Lint; |
|
38 import com.sun.tools.javac.code.Source; |
|
39 import com.sun.tools.javac.code.Type; |
|
40 import com.sun.tools.javac.jvm.Target; |
|
41 import com.sun.tools.javac.main.JavacOption.HiddenOption; |
|
42 import com.sun.tools.javac.main.JavacOption.Option; |
|
43 import com.sun.tools.javac.main.JavacOption.XOption; |
|
44 import com.sun.tools.javac.processing.JavacProcessingEnvironment; |
|
45 import com.sun.tools.javac.util.ListBuffer; |
|
46 import com.sun.tools.javac.util.Log; |
|
47 import com.sun.tools.javac.util.Log.PrefixKind; |
|
48 import com.sun.tools.javac.util.Options; |
46 |
49 |
47 import static com.sun.tools.javac.main.OptionName.*; |
50 import static com.sun.tools.javac.main.OptionName.*; |
48 |
51 |
49 /** |
52 /** |
50 * TODO: describe com.sun.tools.javac.main.RecognizedOptions |
53 * TODO: describe com.sun.tools.javac.main.RecognizedOptions |
77 void addClassName(String s); |
80 void addClassName(String s); |
78 |
81 |
79 } |
82 } |
80 |
83 |
81 public static class GrumpyHelper implements OptionHelper { |
84 public static class GrumpyHelper implements OptionHelper { |
|
85 private Log log; |
|
86 |
|
87 public GrumpyHelper(Log log) { |
|
88 this.log = log; |
|
89 } |
82 |
90 |
83 public void setOut(PrintWriter out) { |
91 public void setOut(PrintWriter out) { |
84 throw new IllegalArgumentException(); |
92 throw new IllegalArgumentException(); |
85 } |
93 } |
86 |
94 |
87 public void error(String key, Object... args) { |
95 public void error(String key, Object... args) { |
88 throw new IllegalArgumentException(Main.getLocalizedString(key, args)); |
96 throw new IllegalArgumentException(log.localize(PrefixKind.JAVAC, key, args)); |
89 } |
97 } |
90 |
98 |
91 public void printVersion() { |
99 public void printVersion() { |
92 throw new IllegalArgumentException(); |
100 throw new IllegalArgumentException(); |
93 } |
101 } |
398 return super.process(options, option); |
406 return super.process(options, option); |
399 } |
407 } |
400 }, |
408 }, |
401 new Option(A, "opt.arg.key.equals.value","opt.A") { |
409 new Option(A, "opt.arg.key.equals.value","opt.A") { |
402 @Override |
410 @Override |
403 String helpSynopsis() { |
411 String helpSynopsis(Log log) { |
404 hasSuffix = true; |
412 hasSuffix = true; |
405 return super.helpSynopsis(); |
413 return super.helpSynopsis(log); |
406 } |
414 } |
407 |
415 |
408 @Override |
416 @Override |
409 public boolean matches(String arg) { |
417 public boolean matches(String arg) { |
410 return arg.startsWith("-A"); |
418 return arg.startsWith("-A"); |
442 |
450 |
443 // This option exists only for the purpose of documenting itself. |
451 // This option exists only for the purpose of documenting itself. |
444 // It's actually implemented by the launcher. |
452 // It's actually implemented by the launcher. |
445 new Option(J, "opt.arg.flag", "opt.J") { |
453 new Option(J, "opt.arg.flag", "opt.J") { |
446 @Override |
454 @Override |
447 String helpSynopsis() { |
455 String helpSynopsis(Log log) { |
448 hasSuffix = true; |
456 hasSuffix = true; |
449 return super.helpSynopsis(); |
457 return super.helpSynopsis(log); |
450 } |
458 } |
451 @Override |
459 @Override |
452 public boolean process(Options options, String option) { |
460 public boolean process(Options options, String option) { |
453 throw new AssertionError |
461 throw new AssertionError |
454 ("the -J flag should be caught by the launcher."); |
462 ("the -J flag should be caught by the launcher."); |
568 |
576 |
569 // This option exists only for the purpose of documenting itself. |
577 // This option exists only for the purpose of documenting itself. |
570 // It's actually implemented by the CommandLine class. |
578 // It's actually implemented by the CommandLine class. |
571 new Option(AT, "opt.arg.file", "opt.AT") { |
579 new Option(AT, "opt.arg.file", "opt.AT") { |
572 @Override |
580 @Override |
573 String helpSynopsis() { |
581 String helpSynopsis(Log log) { |
574 hasSuffix = true; |
582 hasSuffix = true; |
575 return super.helpSynopsis(); |
583 return super.helpSynopsis(log); |
576 } |
584 } |
577 @Override |
585 @Override |
578 public boolean process(Options options, String option) { |
586 public boolean process(Options options, String option) { |
579 throw new AssertionError |
587 throw new AssertionError |
580 ("the @ flag should be caught by CommandLine."); |
588 ("the @ flag should be caught by CommandLine."); |