207 WrappedJavaFileManager(JavaFileManager clientJavaFileManager) { |
209 WrappedJavaFileManager(JavaFileManager clientJavaFileManager) { |
208 clientJavaFileManager.getClass(); // null check |
210 clientJavaFileManager.getClass(); // null check |
209 this.clientJavaFileManager = clientJavaFileManager; |
211 this.clientJavaFileManager = clientJavaFileManager; |
210 } |
212 } |
211 |
213 |
212 @Override |
214 @Override @DefinedBy(Api.COMPILER) |
213 public ClassLoader getClassLoader(Location location) { |
215 public ClassLoader getClassLoader(Location location) { |
214 try { |
216 try { |
215 return clientJavaFileManager.getClassLoader(location); |
217 return clientJavaFileManager.getClassLoader(location); |
216 } catch (ClientCodeException e) { |
218 } catch (ClientCodeException e) { |
217 throw e; |
219 throw e; |
218 } catch (RuntimeException | Error e) { |
220 } catch (RuntimeException | Error e) { |
219 throw new ClientCodeException(e); |
221 throw new ClientCodeException(e); |
220 } |
222 } |
221 } |
223 } |
222 |
224 |
223 @Override |
225 @Override @DefinedBy(Api.COMPILER) |
224 public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException { |
226 public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException { |
225 try { |
227 try { |
226 return wrapJavaFileObjects(clientJavaFileManager.list(location, packageName, kinds, recurse)); |
228 return wrapJavaFileObjects(clientJavaFileManager.list(location, packageName, kinds, recurse)); |
227 } catch (ClientCodeException e) { |
229 } catch (ClientCodeException e) { |
228 throw e; |
230 throw e; |
229 } catch (RuntimeException | Error e) { |
231 } catch (RuntimeException | Error e) { |
230 throw new ClientCodeException(e); |
232 throw new ClientCodeException(e); |
231 } |
233 } |
232 } |
234 } |
233 |
235 |
234 @Override |
236 @Override @DefinedBy(Api.COMPILER) |
235 public String inferBinaryName(Location location, JavaFileObject file) { |
237 public String inferBinaryName(Location location, JavaFileObject file) { |
236 try { |
238 try { |
237 return clientJavaFileManager.inferBinaryName(location, unwrap(file)); |
239 return clientJavaFileManager.inferBinaryName(location, unwrap(file)); |
238 } catch (ClientCodeException e) { |
240 } catch (ClientCodeException e) { |
239 throw e; |
241 throw e; |
240 } catch (RuntimeException | Error e) { |
242 } catch (RuntimeException | Error e) { |
241 throw new ClientCodeException(e); |
243 throw new ClientCodeException(e); |
242 } |
244 } |
243 } |
245 } |
244 |
246 |
245 @Override |
247 @Override @DefinedBy(Api.COMPILER) |
246 public boolean isSameFile(FileObject a, FileObject b) { |
248 public boolean isSameFile(FileObject a, FileObject b) { |
247 try { |
249 try { |
248 return clientJavaFileManager.isSameFile(unwrap(a), unwrap(b)); |
250 return clientJavaFileManager.isSameFile(unwrap(a), unwrap(b)); |
249 } catch (ClientCodeException e) { |
251 } catch (ClientCodeException e) { |
250 throw e; |
252 throw e; |
251 } catch (RuntimeException | Error e) { |
253 } catch (RuntimeException | Error e) { |
252 throw new ClientCodeException(e); |
254 throw new ClientCodeException(e); |
253 } |
255 } |
254 } |
256 } |
255 |
257 |
256 @Override |
258 @Override @DefinedBy(Api.COMPILER) |
257 public boolean handleOption(String current, Iterator<String> remaining) { |
259 public boolean handleOption(String current, Iterator<String> remaining) { |
258 try { |
260 try { |
259 return clientJavaFileManager.handleOption(current, remaining); |
261 return clientJavaFileManager.handleOption(current, remaining); |
260 } catch (ClientCodeException e) { |
262 } catch (ClientCodeException e) { |
261 throw e; |
263 throw e; |
262 } catch (RuntimeException | Error e) { |
264 } catch (RuntimeException | Error e) { |
263 throw new ClientCodeException(e); |
265 throw new ClientCodeException(e); |
264 } |
266 } |
265 } |
267 } |
266 |
268 |
267 @Override |
269 @Override @DefinedBy(Api.COMPILER) |
268 public boolean hasLocation(Location location) { |
270 public boolean hasLocation(Location location) { |
269 try { |
271 try { |
270 return clientJavaFileManager.hasLocation(location); |
272 return clientJavaFileManager.hasLocation(location); |
271 } catch (ClientCodeException e) { |
273 } catch (ClientCodeException e) { |
272 throw e; |
274 throw e; |
273 } catch (RuntimeException | Error e) { |
275 } catch (RuntimeException | Error e) { |
274 throw new ClientCodeException(e); |
276 throw new ClientCodeException(e); |
275 } |
277 } |
276 } |
278 } |
277 |
279 |
278 @Override |
280 @Override @DefinedBy(Api.COMPILER) |
279 public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException { |
281 public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException { |
280 try { |
282 try { |
281 return wrap(clientJavaFileManager.getJavaFileForInput(location, className, kind)); |
283 return wrap(clientJavaFileManager.getJavaFileForInput(location, className, kind)); |
282 } catch (ClientCodeException e) { |
284 } catch (ClientCodeException e) { |
283 throw e; |
285 throw e; |
284 } catch (RuntimeException | Error e) { |
286 } catch (RuntimeException | Error e) { |
285 throw new ClientCodeException(e); |
287 throw new ClientCodeException(e); |
286 } |
288 } |
287 } |
289 } |
288 |
290 |
289 @Override |
291 @Override @DefinedBy(Api.COMPILER) |
290 public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException { |
292 public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException { |
291 try { |
293 try { |
292 return wrap(clientJavaFileManager.getJavaFileForOutput(location, className, kind, unwrap(sibling))); |
294 return wrap(clientJavaFileManager.getJavaFileForOutput(location, className, kind, unwrap(sibling))); |
293 } catch (ClientCodeException e) { |
295 } catch (ClientCodeException e) { |
294 throw e; |
296 throw e; |
295 } catch (RuntimeException | Error e) { |
297 } catch (RuntimeException | Error e) { |
296 throw new ClientCodeException(e); |
298 throw new ClientCodeException(e); |
297 } |
299 } |
298 } |
300 } |
299 |
301 |
300 @Override |
302 @Override @DefinedBy(Api.COMPILER) |
301 public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { |
303 public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { |
302 try { |
304 try { |
303 return wrap(clientJavaFileManager.getFileForInput(location, packageName, relativeName)); |
305 return wrap(clientJavaFileManager.getFileForInput(location, packageName, relativeName)); |
304 } catch (ClientCodeException e) { |
306 } catch (ClientCodeException e) { |
305 throw e; |
307 throw e; |
306 } catch (RuntimeException | Error e) { |
308 } catch (RuntimeException | Error e) { |
307 throw new ClientCodeException(e); |
309 throw new ClientCodeException(e); |
308 } |
310 } |
309 } |
311 } |
310 |
312 |
311 @Override |
313 @Override @DefinedBy(Api.COMPILER) |
312 public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException { |
314 public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException { |
313 try { |
315 try { |
314 return wrap(clientJavaFileManager.getFileForOutput(location, packageName, relativeName, unwrap(sibling))); |
316 return wrap(clientJavaFileManager.getFileForOutput(location, packageName, relativeName, unwrap(sibling))); |
315 } catch (ClientCodeException e) { |
317 } catch (ClientCodeException e) { |
316 throw e; |
318 throw e; |
317 } catch (RuntimeException | Error e) { |
319 } catch (RuntimeException | Error e) { |
318 throw new ClientCodeException(e); |
320 throw new ClientCodeException(e); |
319 } |
321 } |
320 } |
322 } |
321 |
323 |
322 @Override |
324 @Override @DefinedBy(Api.COMPILER) |
323 public void flush() throws IOException { |
325 public void flush() throws IOException { |
324 try { |
326 try { |
325 clientJavaFileManager.flush(); |
327 clientJavaFileManager.flush(); |
326 } catch (ClientCodeException e) { |
328 } catch (ClientCodeException e) { |
327 throw e; |
329 throw e; |
328 } catch (RuntimeException | Error e) { |
330 } catch (RuntimeException | Error e) { |
329 throw new ClientCodeException(e); |
331 throw new ClientCodeException(e); |
330 } |
332 } |
331 } |
333 } |
332 |
334 |
333 @Override |
335 @Override @DefinedBy(Api.COMPILER) |
334 public void close() throws IOException { |
336 public void close() throws IOException { |
335 try { |
337 try { |
336 clientJavaFileManager.close(); |
338 clientJavaFileManager.close(); |
337 } catch (ClientCodeException e) { |
339 } catch (ClientCodeException e) { |
338 throw e; |
340 throw e; |
339 } catch (RuntimeException | Error e) { |
341 } catch (RuntimeException | Error e) { |
340 throw new ClientCodeException(e); |
342 throw new ClientCodeException(e); |
341 } |
343 } |
342 } |
344 } |
343 |
345 |
344 @Override |
346 @Override @DefinedBy(Api.COMPILER) |
345 public int isSupportedOption(String option) { |
347 public int isSupportedOption(String option) { |
346 try { |
348 try { |
347 return clientJavaFileManager.isSupportedOption(option); |
349 return clientJavaFileManager.isSupportedOption(option); |
348 } catch (ClientCodeException e) { |
350 } catch (ClientCodeException e) { |
349 throw e; |
351 throw e; |
363 WrappedFileObject(FileObject clientFileObject) { |
365 WrappedFileObject(FileObject clientFileObject) { |
364 clientFileObject.getClass(); // null check |
366 clientFileObject.getClass(); // null check |
365 this.clientFileObject = clientFileObject; |
367 this.clientFileObject = clientFileObject; |
366 } |
368 } |
367 |
369 |
368 @Override |
370 @Override @DefinedBy(Api.COMPILER) |
369 public URI toUri() { |
371 public URI toUri() { |
370 try { |
372 try { |
371 return clientFileObject.toUri(); |
373 return clientFileObject.toUri(); |
372 } catch (ClientCodeException e) { |
374 } catch (ClientCodeException e) { |
373 throw e; |
375 throw e; |
374 } catch (RuntimeException | Error e) { |
376 } catch (RuntimeException | Error e) { |
375 throw new ClientCodeException(e); |
377 throw new ClientCodeException(e); |
376 } |
378 } |
377 } |
379 } |
378 |
380 |
379 @Override |
381 @Override @DefinedBy(Api.COMPILER) |
380 public String getName() { |
382 public String getName() { |
381 try { |
383 try { |
382 return clientFileObject.getName(); |
384 return clientFileObject.getName(); |
383 } catch (ClientCodeException e) { |
385 } catch (ClientCodeException e) { |
384 throw e; |
386 throw e; |
385 } catch (RuntimeException | Error e) { |
387 } catch (RuntimeException | Error e) { |
386 throw new ClientCodeException(e); |
388 throw new ClientCodeException(e); |
387 } |
389 } |
388 } |
390 } |
389 |
391 |
390 @Override |
392 @Override @DefinedBy(Api.COMPILER) |
391 public InputStream openInputStream() throws IOException { |
393 public InputStream openInputStream() throws IOException { |
392 try { |
394 try { |
393 return clientFileObject.openInputStream(); |
395 return clientFileObject.openInputStream(); |
394 } catch (ClientCodeException e) { |
396 } catch (ClientCodeException e) { |
395 throw e; |
397 throw e; |
396 } catch (RuntimeException | Error e) { |
398 } catch (RuntimeException | Error e) { |
397 throw new ClientCodeException(e); |
399 throw new ClientCodeException(e); |
398 } |
400 } |
399 } |
401 } |
400 |
402 |
401 @Override |
403 @Override @DefinedBy(Api.COMPILER) |
402 public OutputStream openOutputStream() throws IOException { |
404 public OutputStream openOutputStream() throws IOException { |
403 try { |
405 try { |
404 return clientFileObject.openOutputStream(); |
406 return clientFileObject.openOutputStream(); |
405 } catch (ClientCodeException e) { |
407 } catch (ClientCodeException e) { |
406 throw e; |
408 throw e; |
407 } catch (RuntimeException | Error e) { |
409 } catch (RuntimeException | Error e) { |
408 throw new ClientCodeException(e); |
410 throw new ClientCodeException(e); |
409 } |
411 } |
410 } |
412 } |
411 |
413 |
412 @Override |
414 @Override @DefinedBy(Api.COMPILER) |
413 public Reader openReader(boolean ignoreEncodingErrors) throws IOException { |
415 public Reader openReader(boolean ignoreEncodingErrors) throws IOException { |
414 try { |
416 try { |
415 return clientFileObject.openReader(ignoreEncodingErrors); |
417 return clientFileObject.openReader(ignoreEncodingErrors); |
416 } catch (ClientCodeException e) { |
418 } catch (ClientCodeException e) { |
417 throw e; |
419 throw e; |
418 } catch (RuntimeException | Error e) { |
420 } catch (RuntimeException | Error e) { |
419 throw new ClientCodeException(e); |
421 throw new ClientCodeException(e); |
420 } |
422 } |
421 } |
423 } |
422 |
424 |
423 @Override |
425 @Override @DefinedBy(Api.COMPILER) |
424 public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { |
426 public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { |
425 try { |
427 try { |
426 return clientFileObject.getCharContent(ignoreEncodingErrors); |
428 return clientFileObject.getCharContent(ignoreEncodingErrors); |
427 } catch (ClientCodeException e) { |
429 } catch (ClientCodeException e) { |
428 throw e; |
430 throw e; |
429 } catch (RuntimeException | Error e) { |
431 } catch (RuntimeException | Error e) { |
430 throw new ClientCodeException(e); |
432 throw new ClientCodeException(e); |
431 } |
433 } |
432 } |
434 } |
433 |
435 |
434 @Override |
436 @Override @DefinedBy(Api.COMPILER) |
435 public Writer openWriter() throws IOException { |
437 public Writer openWriter() throws IOException { |
436 try { |
438 try { |
437 return clientFileObject.openWriter(); |
439 return clientFileObject.openWriter(); |
438 } catch (ClientCodeException e) { |
440 } catch (ClientCodeException e) { |
439 throw e; |
441 throw e; |
440 } catch (RuntimeException | Error e) { |
442 } catch (RuntimeException | Error e) { |
441 throw new ClientCodeException(e); |
443 throw new ClientCodeException(e); |
442 } |
444 } |
443 } |
445 } |
444 |
446 |
445 @Override |
447 @Override @DefinedBy(Api.COMPILER) |
446 public long getLastModified() { |
448 public long getLastModified() { |
447 try { |
449 try { |
448 return clientFileObject.getLastModified(); |
450 return clientFileObject.getLastModified(); |
449 } catch (ClientCodeException e) { |
451 } catch (ClientCodeException e) { |
450 throw e; |
452 throw e; |
451 } catch (RuntimeException | Error e) { |
453 } catch (RuntimeException | Error e) { |
452 throw new ClientCodeException(e); |
454 throw new ClientCodeException(e); |
453 } |
455 } |
454 } |
456 } |
455 |
457 |
456 @Override |
458 @Override @DefinedBy(Api.COMPILER) |
457 public boolean delete() { |
459 public boolean delete() { |
458 try { |
460 try { |
459 return clientFileObject.delete(); |
461 return clientFileObject.delete(); |
460 } catch (ClientCodeException e) { |
462 } catch (ClientCodeException e) { |
461 throw e; |
463 throw e; |
473 protected class WrappedJavaFileObject extends WrappedFileObject implements JavaFileObject { |
475 protected class WrappedJavaFileObject extends WrappedFileObject implements JavaFileObject { |
474 WrappedJavaFileObject(JavaFileObject clientJavaFileObject) { |
476 WrappedJavaFileObject(JavaFileObject clientJavaFileObject) { |
475 super(clientJavaFileObject); |
477 super(clientJavaFileObject); |
476 } |
478 } |
477 |
479 |
478 @Override |
480 @Override @DefinedBy(Api.COMPILER) |
479 public Kind getKind() { |
481 public Kind getKind() { |
480 try { |
482 try { |
481 return ((JavaFileObject)clientFileObject).getKind(); |
483 return ((JavaFileObject)clientFileObject).getKind(); |
482 } catch (ClientCodeException e) { |
484 } catch (ClientCodeException e) { |
483 throw e; |
485 throw e; |
484 } catch (RuntimeException | Error e) { |
486 } catch (RuntimeException | Error e) { |
485 throw new ClientCodeException(e); |
487 throw new ClientCodeException(e); |
486 } |
488 } |
487 } |
489 } |
488 |
490 |
489 @Override |
491 @Override @DefinedBy(Api.COMPILER) |
490 public boolean isNameCompatible(String simpleName, Kind kind) { |
492 public boolean isNameCompatible(String simpleName, Kind kind) { |
491 try { |
493 try { |
492 return ((JavaFileObject)clientFileObject).isNameCompatible(simpleName, kind); |
494 return ((JavaFileObject)clientFileObject).isNameCompatible(simpleName, kind); |
493 } catch (ClientCodeException e) { |
495 } catch (ClientCodeException e) { |
494 throw e; |
496 throw e; |
495 } catch (RuntimeException | Error e) { |
497 } catch (RuntimeException | Error e) { |
496 throw new ClientCodeException(e); |
498 throw new ClientCodeException(e); |
497 } |
499 } |
498 } |
500 } |
499 |
501 |
500 @Override |
502 @Override @DefinedBy(Api.COMPILER) |
501 public NestingKind getNestingKind() { |
503 public NestingKind getNestingKind() { |
502 try { |
504 try { |
503 return ((JavaFileObject)clientFileObject).getNestingKind(); |
505 return ((JavaFileObject)clientFileObject).getNestingKind(); |
504 } catch (ClientCodeException e) { |
506 } catch (ClientCodeException e) { |
505 throw e; |
507 throw e; |
506 } catch (RuntimeException | Error e) { |
508 } catch (RuntimeException | Error e) { |
507 throw new ClientCodeException(e); |
509 throw new ClientCodeException(e); |
508 } |
510 } |
509 } |
511 } |
510 |
512 |
511 @Override |
513 @Override @DefinedBy(Api.COMPILER) |
512 public Modifier getAccessLevel() { |
514 public Modifier getAccessLevel() { |
513 try { |
515 try { |
514 return ((JavaFileObject)clientFileObject).getAccessLevel(); |
516 return ((JavaFileObject)clientFileObject).getAccessLevel(); |
515 } catch (ClientCodeException e) { |
517 } catch (ClientCodeException e) { |
516 throw e; |
518 throw e; |
554 |
556 |
555 DiagnosticSourceUnwrapper(JCDiagnostic d) { |
557 DiagnosticSourceUnwrapper(JCDiagnostic d) { |
556 this.d = d; |
558 this.d = d; |
557 } |
559 } |
558 |
560 |
|
561 @DefinedBy(Api.COMPILER) |
559 public Diagnostic.Kind getKind() { |
562 public Diagnostic.Kind getKind() { |
560 return d.getKind(); |
563 return d.getKind(); |
561 } |
564 } |
562 |
565 |
|
566 @DefinedBy(Api.COMPILER) |
563 public JavaFileObject getSource() { |
567 public JavaFileObject getSource() { |
564 return unwrap(d.getSource()); |
568 return unwrap(d.getSource()); |
565 } |
569 } |
566 |
570 |
|
571 @DefinedBy(Api.COMPILER) |
567 public long getPosition() { |
572 public long getPosition() { |
568 return d.getPosition(); |
573 return d.getPosition(); |
569 } |
574 } |
570 |
575 |
|
576 @DefinedBy(Api.COMPILER) |
571 public long getStartPosition() { |
577 public long getStartPosition() { |
572 return d.getStartPosition(); |
578 return d.getStartPosition(); |
573 } |
579 } |
574 |
580 |
|
581 @DefinedBy(Api.COMPILER) |
575 public long getEndPosition() { |
582 public long getEndPosition() { |
576 return d.getEndPosition(); |
583 return d.getEndPosition(); |
577 } |
584 } |
578 |
585 |
|
586 @DefinedBy(Api.COMPILER) |
579 public long getLineNumber() { |
587 public long getLineNumber() { |
580 return d.getLineNumber(); |
588 return d.getLineNumber(); |
581 } |
589 } |
582 |
590 |
|
591 @DefinedBy(Api.COMPILER) |
583 public long getColumnNumber() { |
592 public long getColumnNumber() { |
584 return d.getColumnNumber(); |
593 return d.getColumnNumber(); |
585 } |
594 } |
586 |
595 |
|
596 @DefinedBy(Api.COMPILER) |
587 public String getCode() { |
597 public String getCode() { |
588 return d.getCode(); |
598 return d.getCode(); |
589 } |
599 } |
590 |
600 |
|
601 @DefinedBy(Api.COMPILER) |
591 public String getMessage(Locale locale) { |
602 public String getMessage(Locale locale) { |
592 return d.getMessage(locale); |
603 return d.getMessage(locale); |
593 } |
604 } |
594 |
605 |
595 @Override |
606 @Override |