From d8d47c687d7ec22e481cf10782f1f889485c39fa Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 15 Aug 2011 22:11:25 +0200 Subject: Integrated Philipp's proof-of-concept delombok in javac7 fix, and used some creative stubbing to ensure both the javac7 and the javac6 source file can be loaded in the same project in eclipse without dependency warnings. --- .../com/sun/tools/javac/file/BaseFileObject.java | 10 ++++ .../com/sun/tools/javac/file/JavacFileManager.java | 6 +++ src/stubs/com/sun/tools/javac/parser/Scanner.java | 62 ++++++++++++++++++++++ .../com/sun/tools/javac/parser/ScannerFactory.java | 21 ++++++++ src/stubs/com/sun/tools/javac/util/Context.java | 31 +++++++++++ 5 files changed, 130 insertions(+) create mode 100644 src/stubs/com/sun/tools/javac/file/BaseFileObject.java create mode 100644 src/stubs/com/sun/tools/javac/file/JavacFileManager.java create mode 100644 src/stubs/com/sun/tools/javac/parser/Scanner.java create mode 100644 src/stubs/com/sun/tools/javac/parser/ScannerFactory.java create mode 100644 src/stubs/com/sun/tools/javac/util/Context.java (limited to 'src/stubs/com/sun') diff --git a/src/stubs/com/sun/tools/javac/file/BaseFileObject.java b/src/stubs/com/sun/tools/javac/file/BaseFileObject.java new file mode 100644 index 00000000..d072fc33 --- /dev/null +++ b/src/stubs/com/sun/tools/javac/file/BaseFileObject.java @@ -0,0 +1,10 @@ +/* + * These are stub versions of various bits of javac-internal API (for various different versions of javac). Lombok is compiled against these. + */ +package com.sun.tools.javac.file; + +import javax.tools.JavaFileObject; + +public abstract class BaseFileObject implements JavaFileObject { + protected BaseFileObject(JavacFileManager fileManager) {} +} diff --git a/src/stubs/com/sun/tools/javac/file/JavacFileManager.java b/src/stubs/com/sun/tools/javac/file/JavacFileManager.java new file mode 100644 index 00000000..ba5f428a --- /dev/null +++ b/src/stubs/com/sun/tools/javac/file/JavacFileManager.java @@ -0,0 +1,6 @@ +/* + * These are stub versions of various bits of javac-internal API (for various different versions of javac). Lombok is compiled against these. + */ +package com.sun.tools.javac.file; + +public class JavacFileManager {} diff --git a/src/stubs/com/sun/tools/javac/parser/Scanner.java b/src/stubs/com/sun/tools/javac/parser/Scanner.java new file mode 100644 index 00000000..f6f1d25d --- /dev/null +++ b/src/stubs/com/sun/tools/javac/parser/Scanner.java @@ -0,0 +1,62 @@ +/* + * These are stub versions of various bits of javac-internal API (for various different versions of javac). Lombok is compiled against these. + */ +package com.sun.tools.javac.parser; + +import java.nio.CharBuffer; + +import com.sun.tools.javac.util.Context; + +public class Scanner { + protected Scanner(Factory fac, CharBuffer buffer) { + } + + protected Scanner(Factory fac, char[] input, int inputLength) { + } + + protected Scanner(ScannerFactory fac, CharBuffer buffer) { + } + + protected Scanner(ScannerFactory fac, char[] input, int inputLength) { + } + + public static class Factory { + public static final Context.Key scannerFactoryKey = null; + + protected Factory(Context context) { + } + + public Scanner newScanner(CharSequence input) { + return null; + } + + public Scanner newScanner(char[] input, int inputLength) { + return null; + } + } + + public enum CommentStyle { + LINE, + BLOCK, + JAVADOC, + } + + protected void processComment(CommentStyle style) { + } + + public int prevEndPos() { + return -1; + } + + public int endPos() { + return -1; + } + + public int pos() { + return -1; + } + + public char[] getRawCharacters(int beginIndex, int endIndex) { + return null; + } +} diff --git a/src/stubs/com/sun/tools/javac/parser/ScannerFactory.java b/src/stubs/com/sun/tools/javac/parser/ScannerFactory.java new file mode 100644 index 00000000..26483db3 --- /dev/null +++ b/src/stubs/com/sun/tools/javac/parser/ScannerFactory.java @@ -0,0 +1,21 @@ +/* + * These are stub versions of various bits of javac-internal API (for various different versions of javac). Lombok is compiled against these. + */ +package com.sun.tools.javac.parser; + +import com.sun.tools.javac.util.Context; + +public class ScannerFactory { + public static final Context.Key scannerFactoryKey = null; + + protected ScannerFactory(Context c) { + } + + public Scanner newScanner(CharSequence input, boolean keepDocComments) { + return null; + } + + public Scanner newScanner(char[] input, int inputLength, boolean keepDocComments) { + return null; + } +} diff --git a/src/stubs/com/sun/tools/javac/util/Context.java b/src/stubs/com/sun/tools/javac/util/Context.java new file mode 100644 index 00000000..06b8ff4d --- /dev/null +++ b/src/stubs/com/sun/tools/javac/util/Context.java @@ -0,0 +1,31 @@ +/* + * These are stub versions of various bits of javac-internal API (for various different versions of javac). Lombok is compiled against these. + */ +package com.sun.tools.javac.util; + +public class Context { + public static class Key { + } + + public interface Factory { + T make(Context c); + T make(); + } + + public void put(Key key, Factory fac) { + } + + public void put(Key key, T data) { + } + + public void put(Class clazz, T data) { + } + + public T get(Key key) { + return null; + } + + public T get(Class clazz) { + return null; + } +} -- cgit