From 4923506d737718cec49e35aa9a273b3a999eefc6 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 7 Jul 2013 22:05:41 +0200 Subject: more work on the tricky Context hack to make 'ant compile' not emit warnings. --- .../lombok/javac/java6/CommentCollectingScannerFactory.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/utils/lombok/javac/java6') diff --git a/src/utils/lombok/javac/java6/CommentCollectingScannerFactory.java b/src/utils/lombok/javac/java6/CommentCollectingScannerFactory.java index c345526e..b7d8ed13 100644 --- a/src/utils/lombok/javac/java6/CommentCollectingScannerFactory.java +++ b/src/utils/lombok/javac/java6/CommentCollectingScannerFactory.java @@ -49,15 +49,21 @@ public class CommentCollectingScannerFactory extends Scanner.Factory { // * Leave the return types as 'j.l.Object'. // * Leave both make methods intact; deleting one has no effect on javac6- / javac7+, but breaks the other. Hard to test for. // * Do not stub com.sun.tools.javac.util.Context or any of its inner types, like Factory. - context.put(scannerFactoryKey, new Context.Factory() { + @SuppressWarnings("all") + class MyFactory implements Context.Factory { + // This overrides the javac6- version of make. public Object make() { return new CommentCollectingScannerFactory(context); } + // This overrides the javac7+ version of make. public Object make(Context c) { return new CommentCollectingScannerFactory(c); } - }); + } + + @SuppressWarnings("unchecked") Context.Factory factory = new MyFactory(); + context.put(scannerFactoryKey, factory); } } -- cgit