Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] source location for initialization

What should the source location be for initialization
and staticinitialization?

Currently, it's reported as line 0.  E.g., try 

  declare warning: initialization(Foo.new(..)) : "init";

AFAIR, the compiler gathers all initializers into one 
block of code, run before any constructor.  

Questions presented [and my position]:

Should the compiler instead report the first instance of an
initializer, or the first line of the target class 
if there is no initializer? [yes]

  class Foo {
    // some comment
    static int i = 2;    // staticinitialization(Foo)
    int i = 3;           // initialization(Foo)
    Foo() { ...}
    ...
  }
  class Bar {
    // some comment      // {static}initialization(Bar)
    ...
  }

Should the answer be different for static initializers,
which (if not constant) are not run until a reference
thereto is evaluated at runtime? [no]

Should it ignore initializers declared in aspects? [no, but...]
Even if those are the only initializers declared for a class?

Is there any strong reason not to defer the answer and 
any related fix until after 1.1? [no]

Wes

cf http://dev.eclipse.org/bugs/show_bug.cgi?id=31724


Back to the top