22 * or visit www.oracle.com if you need additional information or have any |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.javac.processing; |
26 package com.sun.tools.javac.processing; |
27 |
|
28 import com.sun.tools.javac.util.*; |
|
29 import javax.annotation.processing.*; |
|
30 import javax.lang.model.SourceVersion; |
|
31 import javax.lang.model.element.NestingKind; |
|
32 import javax.lang.model.element.Modifier; |
|
33 import javax.lang.model.element.Element; |
|
34 import java.util.*; |
|
35 |
27 |
36 import java.io.Closeable; |
28 import java.io.Closeable; |
37 import java.io.FileNotFoundException; |
29 import java.io.FileNotFoundException; |
38 import java.io.InputStream; |
30 import java.io.InputStream; |
39 import java.io.OutputStream; |
31 import java.io.OutputStream; |
41 import java.io.Reader; |
33 import java.io.Reader; |
42 import java.io.Writer; |
34 import java.io.Writer; |
43 import java.io.FilterWriter; |
35 import java.io.FilterWriter; |
44 import java.io.PrintWriter; |
36 import java.io.PrintWriter; |
45 import java.io.IOException; |
37 import java.io.IOException; |
46 |
38 import java.util.*; |
|
39 |
|
40 import static java.util.Collections.*; |
|
41 |
|
42 import javax.annotation.processing.*; |
|
43 import javax.lang.model.SourceVersion; |
|
44 import javax.lang.model.element.NestingKind; |
|
45 import javax.lang.model.element.Modifier; |
|
46 import javax.lang.model.element.Element; |
47 import javax.tools.*; |
47 import javax.tools.*; |
48 import static java.util.Collections.*; |
|
49 |
|
50 import javax.tools.JavaFileManager.Location; |
48 import javax.tools.JavaFileManager.Location; |
|
49 |
51 import static javax.tools.StandardLocation.SOURCE_OUTPUT; |
50 import static javax.tools.StandardLocation.SOURCE_OUTPUT; |
52 import static javax.tools.StandardLocation.CLASS_OUTPUT; |
51 import static javax.tools.StandardLocation.CLASS_OUTPUT; |
|
52 |
|
53 import com.sun.tools.javac.code.Lint; |
|
54 import com.sun.tools.javac.util.*; |
|
55 |
|
56 import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING; |
53 |
57 |
54 /** |
58 /** |
55 * The FilerImplementation class must maintain a number of |
59 * The FilerImplementation class must maintain a number of |
56 * constraints. First, multiple attempts to open the same path within |
60 * constraints. First, multiple attempts to open the same path within |
57 * the same invocation of the tool results in an IOException being |
61 * the same invocation of the tool results in an IOException being |
364 openTypeNames = synchronizedSet(new LinkedHashSet<String>()); |
368 openTypeNames = synchronizedSet(new LinkedHashSet<String>()); |
365 |
369 |
366 aggregateGeneratedSourceNames = new LinkedHashSet<String>(); |
370 aggregateGeneratedSourceNames = new LinkedHashSet<String>(); |
367 aggregateGeneratedClassNames = new LinkedHashSet<String>(); |
371 aggregateGeneratedClassNames = new LinkedHashSet<String>(); |
368 |
372 |
369 lint = (Options.instance(context)).lint("processing"); |
373 lint = (Lint.instance(context)).isEnabled(PROCESSING); |
370 } |
374 } |
371 |
375 |
372 public JavaFileObject createSourceFile(CharSequence name, |
376 public JavaFileObject createSourceFile(CharSequence name, |
373 Element... originatingElements) throws IOException { |
377 Element... originatingElements) throws IOException { |
374 return createSourceOrClassFile(true, name.toString()); |
378 return createSourceOrClassFile(true, name.toString()); |