[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| [aspectj-dev] final ITD field | 
While I know that a final ITD is not actually final and understand why
(couldn't be initialized from outside target class) I am puzzled that an
instance field cannot be set within an ITD constructor. Is this just a
current compiler limitation or is there some more fundamental restriction.
In the following example I can set in a constructor a final field defined
in HelloWorld but not an ITD field within an ITD constructor
public class HelloWorld {
      public static int i1;
      public HelloWorld () {
            i1 = 9;
      }
      public void println () {
            System.out.println("Hello World!");
      }
      public static void main(String[] args) {
            new HelloWorld().println();
      }
}
public aspect ITDModifiersTest {
      public final int HelloWorld.i2;
      public HelloWorld.new (int i) {
            i2 = i; // ERROR
      }
}
Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/