diff options
author | Roel Spilker <r.spilker@gmail.com> | 2014-01-15 21:36:52 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2014-01-15 21:36:52 +0100 |
commit | 610f250c1d84d98537ecd480ce19c4894bce503b (patch) | |
tree | 3ade54207baaaa138e1ac37a6fd766a66b0ed123 | |
parent | 923a3660037d22fef881db1615429d937b6701e6 (diff) | |
download | lombok-610f250c1d84d98537ecd480ce19c4894bce503b.tar.gz lombok-610f250c1d84d98537ecd480ce19c4894bce503b.tar.bz2 lombok-610f250c1d84d98537ecd480ce19c4894bce503b.zip |
[configuration] Implement LombokConfiguration (using the CONSOLE error reporter)
-rw-r--r-- | src/core/lombok/core/LombokConfiguration.java | 54 |
1 files changed, 6 insertions, 48 deletions
diff --git a/src/core/lombok/core/LombokConfiguration.java b/src/core/lombok/core/LombokConfiguration.java index 40c4a67c..0c391bf4 100644 --- a/src/core/lombok/core/LombokConfiguration.java +++ b/src/core/lombok/core/LombokConfiguration.java @@ -21,62 +21,20 @@ */ package lombok.core; -import java.util.List; - -import javax.lang.model.SourceVersion; - +import lombok.core.configuration.BubblingConfigurationResolver; +import lombok.core.configuration.ConfigurationErrorReporterFactory; import lombok.core.configuration.ConfigurationKey; +import lombok.core.configuration.FileSystemSourceCache; public class LombokConfiguration { + private static FileSystemSourceCache cache = new FileSystemSourceCache(); + private LombokConfiguration() { // prevent instantiation } - static <T> T read(ConfigurationKey<T> key, AST<?, ?, ?> ast) { -// if (key.keyName.equals("lombok.log.varName")) return (T)"loggertje"; -// if (key.keyName.equals("lombok.log.static")) return (T)Boolean.FALSE; - return null; - } - - @SuppressWarnings("rawtypes") - public static void main(String[] args) { - try { new ConfigurationKey<List<String>>("List<String>") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<Integer>("Integer") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<Class<?>>("Class<?>") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<SourceVersion>("SourceVersion") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<Class>("Class") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<Class<Number>>("Class<Number>") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<Class<? extends Number>>("Class<? extends Number>") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<Class<? super String>>("Class<? super String>") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<Number>("Number") {}; } catch (Exception e) { e.printStackTrace();} - try { class Between extends ConfigurationKey<String> { - public Between() { - super("between"); - } - }; - new Between(){}; - } catch (Exception e) { e.printStackTrace();} - - try { new ConfigurationKey<String>("more than once") {}; } catch (Exception e) { e.printStackTrace();} - try { new ConfigurationKey<Integer>("more than once") {}; } catch (Exception e) { e.printStackTrace();} - - System.out.println(System.identityHashCode(ConfigurationKey.registeredKeys())); - System.out.println(System.identityHashCode(ConfigurationKey.registeredKeys())); - - ConfigurationKey<?> first = null; - try { first = new ConfigurationKey<Integer>("anint") {}; } catch (Exception e) { e.printStackTrace();} - System.out.println(System.identityHashCode(ConfigurationKey.registeredKeys())); - System.out.println(System.identityHashCode(ConfigurationKey.registeredKeys())); - - ConfigurationKey<?> second = null; - try { second = new ConfigurationKey<Integer>("anint") {}; } catch (Exception e) { e.printStackTrace();} - System.out.println(System.identityHashCode(ConfigurationKey.registeredKeys())); - System.out.println(System.identityHashCode(ConfigurationKey.registeredKeys())); - - System.out.println(first == second); - System.out.println(first.getClass() == second.getClass()); - System.out.println(first.equals(second)); + return new BubblingConfigurationResolver(cache.sourcesForJavaFile(ast.getAbsoluteFileLocation(), ConfigurationErrorReporterFactory.CONSOLE)).resolve(key); } } |