langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java
equal
deleted
inserted
replaced
35 |
35 |
36 import javax.tools.*; |
36 import javax.tools.*; |
37 import javax.tools.JavaFileObject.Kind; |
37 import javax.tools.JavaFileObject.Kind; |
38 |
38 |
39 import com.sun.tools.javac.file.JavacFileManager; |
39 import com.sun.tools.javac.file.JavacFileManager; |
|
40 import com.sun.tools.javac.util.DefinedBy; |
|
41 import com.sun.tools.javac.util.DefinedBy.Api; |
40 import com.sun.tools.javac.util.ListBuffer; |
42 import com.sun.tools.javac.util.ListBuffer; |
41 |
43 |
42 /** |
44 /** |
43 * Intercepts reads and writes to the file system to gather |
45 * Intercepts reads and writes to the file system to gather |
44 * information about what artifacts are generated. |
46 * information about what artifacts are generated. |
90 |
92 |
91 public Map<String,Set<URI>> getPackageArtifacts() { |
93 public Map<String,Set<URI>> getPackageArtifacts() { |
92 return packageArtifacts; |
94 return packageArtifacts; |
93 } |
95 } |
94 |
96 |
95 @Override |
97 @Override @DefinedBy(Api.COMPILER) |
96 public Iterable<JavaFileObject> list(Location location, |
98 public Iterable<JavaFileObject> list(Location location, |
97 String packageName, |
99 String packageName, |
98 Set<Kind> kinds, |
100 Set<Kind> kinds, |
99 boolean recurse) throws IOException { |
101 boolean recurse) throws IOException { |
100 // Acquire the list of files. |
102 // Acquire the list of files. |
114 } |
116 } |
115 } |
117 } |
116 return filteredFiles; |
118 return filteredFiles; |
117 } |
119 } |
118 |
120 |
119 @Override |
121 @Override @DefinedBy(Api.COMPILER) |
120 public boolean hasLocation(Location location) { |
122 public boolean hasLocation(Location location) { |
121 return super.hasLocation(location); |
123 return super.hasLocation(location); |
122 } |
124 } |
123 |
125 |
124 @Override |
126 @Override @DefinedBy(Api.COMPILER) |
125 public JavaFileObject getJavaFileForInput(Location location, |
127 public JavaFileObject getJavaFileForInput(Location location, |
126 String className, |
128 String className, |
127 Kind kind) throws IOException { |
129 Kind kind) throws IOException { |
128 JavaFileObject file = super.getJavaFileForInput(location, className, kind); |
130 JavaFileObject file = super.getJavaFileForInput(location, className, kind); |
129 if (file == null || visibleSources.isEmpty()) { |
131 if (file == null || visibleSources.isEmpty()) { |
134 return file; |
136 return file; |
135 } |
137 } |
136 return null; |
138 return null; |
137 } |
139 } |
138 |
140 |
139 @Override |
141 @Override @DefinedBy(Api.COMPILER) |
140 public JavaFileObject getJavaFileForOutput(Location location, |
142 public JavaFileObject getJavaFileForOutput(Location location, |
141 String className, |
143 String className, |
142 Kind kind, |
144 Kind kind, |
143 FileObject sibling) throws IOException { |
145 FileObject sibling) throws IOException { |
144 JavaFileObject file = super.getJavaFileForOutput(location, className, kind, sibling); |
146 JavaFileObject file = super.getJavaFileForOutput(location, className, kind, sibling); |
152 String mod_name = ""; |
154 String mod_name = ""; |
153 addArtifact(mod_name+":"+pkg_name, file.toUri()); |
155 addArtifact(mod_name+":"+pkg_name, file.toUri()); |
154 return file; |
156 return file; |
155 } |
157 } |
156 |
158 |
157 @Override |
159 @Override @DefinedBy(Api.COMPILER) |
158 public FileObject getFileForInput(Location location, |
160 public FileObject getFileForInput(Location location, |
159 String packageName, |
161 String packageName, |
160 String relativeName) throws IOException { |
162 String relativeName) throws IOException { |
161 FileObject file = super.getFileForInput(location, packageName, relativeName); |
163 FileObject file = super.getFileForInput(location, packageName, relativeName); |
162 if (file == null || visibleSources.isEmpty()) { |
164 if (file == null || visibleSources.isEmpty()) { |
167 return file; |
169 return file; |
168 } |
170 } |
169 return null; |
171 return null; |
170 } |
172 } |
171 |
173 |
172 @Override |
174 @Override @DefinedBy(Api.COMPILER) |
173 public FileObject getFileForOutput(Location location, |
175 public FileObject getFileForOutput(Location location, |
174 String packageName, |
176 String packageName, |
175 String relativeName, |
177 String relativeName, |
176 FileObject sibling) throws IOException { |
178 FileObject sibling) throws IOException { |
177 FileObject file = super.getFileForOutput(location, packageName, relativeName, sibling); |
179 FileObject file = super.getFileForOutput(location, packageName, relativeName, sibling); |
199 p = fn.indexOf('_',pp); |
201 p = fn.indexOf('_',pp); |
200 } |
202 } |
201 return sb.toString(); |
203 return sb.toString(); |
202 } |
204 } |
203 |
205 |
204 @Override |
206 @Override @DefinedBy(Api.COMPILER) |
205 public void flush() throws IOException { |
207 public void flush() throws IOException { |
206 super.flush(); |
208 super.flush(); |
207 } |
209 } |
208 |
210 |
209 @Override |
211 @Override @DefinedBy(Api.COMPILER) |
210 public void close() throws IOException { |
212 public void close() throws IOException { |
211 super.close(); |
213 super.close(); |
212 } |
214 } |
213 |
215 |
214 void addArtifact(String pkgName, URI art) { |
216 void addArtifact(String pkgName, URI art) { |