33 import java.util.HashMap;
34 import java.util.HashSet;
35 import java.util.Map;
36 import java.util.Set;
37
38 import javax.tools.*;
39 import javax.tools.JavaFileObject.Kind;
40
41 import com.sun.tools.javac.file.JavacFileManager;
42 import com.sun.tools.javac.util.DefinedBy;
43 import com.sun.tools.javac.util.DefinedBy.Api;
44 import com.sun.tools.javac.util.ListBuffer;
45
46 /**
47 * Intercepts reads and writes to the file system to gather
48 * information about what artifacts are generated.
49 *
50 * Traps writes to certain files, if the content written is identical
51 * to the existing file.
52 *
53 * Can also blind out the filemanager from seeing certain files in the file system.
54 * Necessary to prevent javac from seeing some sources where the source path points.
55 *
56 * <p><b>This is NOT part of any supported API.
57 * If you write code that depends on this, you do so at your own risk.
58 * This code and its internal interfaces are subject to change or
59 * deletion without notice.</b>
60 */
61 @com.sun.tools.javac.api.ClientCodeWrapper.Trusted
62 public class SmartFileManager extends ForwardingJavaFileManager<JavaFileManager> {
63
64 // Set of sources that can be seen by javac.
65 Set<URI> visibleSources = new HashSet<>();
66 // Map from modulename:packagename to artifacts.
67 Map<String,Set<URI>> packageArtifacts = new HashMap<>();
68
69 public SmartFileManager(JavaFileManager fileManager) {
70 super(fileManager);
71 }
72
73 public void setVisibleSources(Set<URI> s) {
|
33 import java.util.HashMap;
34 import java.util.HashSet;
35 import java.util.Map;
36 import java.util.Set;
37
38 import javax.tools.*;
39 import javax.tools.JavaFileObject.Kind;
40
41 import com.sun.tools.javac.file.JavacFileManager;
42 import com.sun.tools.javac.util.DefinedBy;
43 import com.sun.tools.javac.util.DefinedBy.Api;
44 import com.sun.tools.javac.util.ListBuffer;
45
46 /**
47 * Intercepts reads and writes to the file system to gather
48 * information about what artifacts are generated.
49 *
50 * Traps writes to certain files, if the content written is identical
51 * to the existing file.
52 *
53 * Can also blind out the file manager from seeing certain files in the file system.
54 * Necessary to prevent javac from seeing some sources where the source path points.
55 *
56 * <p><b>This is NOT part of any supported API.
57 * If you write code that depends on this, you do so at your own risk.
58 * This code and its internal interfaces are subject to change or
59 * deletion without notice.</b>
60 */
61 @com.sun.tools.javac.api.ClientCodeWrapper.Trusted
62 public class SmartFileManager extends ForwardingJavaFileManager<JavaFileManager> {
63
64 // Set of sources that can be seen by javac.
65 Set<URI> visibleSources = new HashSet<>();
66 // Map from modulename:packagename to artifacts.
67 Map<String,Set<URI>> packageArtifacts = new HashMap<>();
68
69 public SmartFileManager(JavaFileManager fileManager) {
70 super(fileManager);
71 }
72
73 public void setVisibleSources(Set<URI> s) {
|