diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-07-07 22:05:41 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-07-07 22:05:41 +0200 |
commit | 4923506d737718cec49e35aa9a273b3a999eefc6 (patch) | |
tree | 661bb6f41639aa59a8c568088cdb1984860ad289 | |
parent | 91bfd390e05ed3d04dff6438ffd1bc9e01eb1fff (diff) | |
download | lombok-4923506d737718cec49e35aa9a273b3a999eefc6.tar.gz lombok-4923506d737718cec49e35aa9a273b3a999eefc6.tar.bz2 lombok-4923506d737718cec49e35aa9a273b3a999eefc6.zip |
more work on the tricky Context hack to make 'ant compile' not emit warnings.
-rw-r--r-- | src/utils/lombok/javac/java6/CommentCollectingScannerFactory.java | 10 | ||||
-rw-r--r-- | src/utils/lombok/javac/java7/CommentCollectingScannerFactory.java | 7 |
2 files changed, 13 insertions, 4 deletions
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<Scanner.Factory> factory = new MyFactory(); + context.put(scannerFactoryKey, factory); } } diff --git a/src/utils/lombok/javac/java7/CommentCollectingScannerFactory.java b/src/utils/lombok/javac/java7/CommentCollectingScannerFactory.java index 2032e494..626d3d63 100644 --- a/src/utils/lombok/javac/java7/CommentCollectingScannerFactory.java +++ b/src/utils/lombok/javac/java7/CommentCollectingScannerFactory.java @@ -50,7 +50,8 @@ public class CommentCollectingScannerFactory extends ScannerFactory { // * 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); @@ -60,7 +61,9 @@ public class CommentCollectingScannerFactory extends ScannerFactory { public Object make(Context c) { return new CommentCollectingScannerFactory(c); } - }); + } + @SuppressWarnings("unchecked") Context.Factory<ScannerFactory> factory = new MyFactory(); + context.put(scannerFactoryKey, factory); } } |