From d4b4a92302af4d52a2a1d07524cb506bdecadf14 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 18 Jul 2011 23:35:02 +0200 Subject: Changes to the lombok annotations processor, forcing the java processing environment into doing multiple rounds and disabling certain reparses in netbeans. Thanks to Jan Lahoda for researching this issue and supplying us with a patch. --- .../javac/apt/InterceptingJavaFileManager.java | 4 +-- .../javac/apt/Javac7BaseFileObjectWrapper.java | 4 +-- src/core/lombok/javac/apt/LombokFileObjects.java | 17 +++++----- src/core/lombok/javac/apt/Processor.java | 36 +++++++++++++++++++++- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/src/core/lombok/javac/apt/InterceptingJavaFileManager.java b/src/core/lombok/javac/apt/InterceptingJavaFileManager.java index 87aeb927..979c1279 100644 --- a/src/core/lombok/javac/apt/InterceptingJavaFileManager.java +++ b/src/core/lombok/javac/apt/InterceptingJavaFileManager.java @@ -43,12 +43,12 @@ final class InterceptingJavaFileManager extends ForwardingJavaFileManager cancelServiceClass = Class.forName("com.sun.tools.javac.util.CancelService"); + Method cancelServiceInstace = cancelServiceClass.getDeclaredMethod("instance", Context.class); + Object cancelService = cancelServiceInstace.invoke(null, context); + if (cancelService == null) return; + Field parserField = cancelService.getClass().getDeclaredField("parser"); + parserField.setAccessible(true); + Object parser = parserField.get(cancelService); + Field supportsReparseField = parser.getClass().getDeclaredField("supportsReparse"); + supportsReparseField.setAccessible(true); + supportsReparseField.set(parser, false); + } catch (ClassNotFoundException e) { + // only NetBeans has it + } catch (NoSuchFieldException e) { + // only NetBeans has it + } catch (Throwable t) { + throw Lombok.sneakyThrow(t); + } + } + private static class WrappingClassLoader extends ClassLoader { private final ClassLoader parent; -- cgit