PROPOSAL: Compiletime information access
rssh at gradsoft.com.ua
rssh at gradsoft.com.ua
Tue Mar 24 10:22:16 PDT 2009
> rssh at gradsoft.com.ua wrote:
>> AUTHOR: Ruslan Shevchenko
>>
>> OVERVIEW:
>>
>> FEATURE SUMMARY:
>>
>> Add API to access compile-time context of current compiled element
>> from
>> programs and annotation processors.
>>
>> MAJOR ADVANTAGE:
>>
>> Now compile time properties are unaccessible for programmer. This
>> meaning
>>
>
> No, this flavor information has been officially accessible for
> programmers using Java SE 6 compilers, which are required to support
> annotation processing and the JSR 199 tools API. See the
> javax.annotation.processing and javax.tools packages, which use
> javax.lang.model.
>
> The view of a type provided by JSR 269 annotation processing is
> read-only, but much of the effect of modifying the file can be had by
> either generating subclasses or the superclass of the type in question.
>
> These APIs don't provide a direct notion of location, but the Messager
> accepts the model of a program element to emit location information.
>
> -Joe
>
Thanks for clarify; actually only fileName, lineNumber, className,
methodName and bindings can't be build with annotation processors. (all
those require context of location inside class be available).
So, this can be rewritten as:
Now compile time properties which depends from local compilation context
(i.e. source location and variable bindings) are unaccessible for
programmer.
Yet one question to community - may be better left in proposal only
methods, which provide information, unaccessible from annotations
(getFileName(); getLineIndex(); getClassName(); getMethodName();
getBindings())
and others (exec and eval) left to annotation processors, which can be
easy constructed ?
More information about the coin-dev
mailing list