23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.javac.code; |
26 package com.sun.tools.javac.code; |
27 |
27 |
|
28 import java.util.*; |
|
29 import javax.lang.model.SourceVersion; |
|
30 import static javax.lang.model.SourceVersion.*; |
|
31 |
28 import com.sun.tools.javac.util.*; |
32 import com.sun.tools.javac.util.*; |
29 import com.sun.tools.javac.jvm.Target; |
33 import com.sun.tools.javac.jvm.Target; |
30 import javax.lang.model.SourceVersion; |
34 |
31 import static javax.lang.model.SourceVersion.*; |
35 import static com.sun.tools.javac.main.OptionName.*; |
32 import java.util.*; |
|
33 |
36 |
34 /** The source language version accepted. |
37 /** The source language version accepted. |
35 * |
38 * |
36 * <p><b>This is NOT part of any supported API. |
39 * <p><b>This is NOT part of any supported API. |
37 * If you write code that depends on this, you do so at your own risk. |
40 * If you write code that depends on this, you do so at your own risk. |
69 |
72 |
70 public static Source instance(Context context) { |
73 public static Source instance(Context context) { |
71 Source instance = context.get(sourceKey); |
74 Source instance = context.get(sourceKey); |
72 if (instance == null) { |
75 if (instance == null) { |
73 Options options = Options.instance(context); |
76 Options options = Options.instance(context); |
74 String sourceString = options.get("-source"); |
77 String sourceString = options.get(SOURCE); |
75 if (sourceString != null) instance = lookup(sourceString); |
78 if (sourceString != null) instance = lookup(sourceString); |
76 if (instance == null) instance = DEFAULT; |
79 if (instance == null) instance = DEFAULT; |
77 context.put(sourceKey, instance); |
80 context.put(sourceKey, instance); |
78 } |
81 } |
79 return instance; |
82 return instance; |