Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] DOM/AST handling of int foo()[]

Opt to fix the bug in the proposed way.

Dirk


|---------+------------------------------>
|         |           "Jim des Rivieres" |
|         |           <Jim_des_Rivieres@o|
|         |           ti.com>            |
|         |           Sent by:           |
|         |           jdt-core-dev-admin@|
|         |           eclipse.org        |
|         |                              |
|         |                              |
|         |           09/11/2002 07:18 PM|
|         |           Please respond to  |
|         |           jdt-core-dev       |
|         |                              |
|---------+------------------------------>
  >------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                  |
  |        To:      jdt-core-dev@xxxxxxxxxxx                                                                         |
  |        cc:                                                                                                       |
  |        Subject: [jdt-core-dev] DOM/AST handling of int foo()[]                                                   |
  >------------------------------------------------------------------------------------------------------------------|



The JDT DOM/AST API is does not make it clear how method declarations like
      int foo()[];
and parameter declarations like
      int a[]
are handled.

The issue concerns the extra "[]"s:
      - for the return type of a MethodDeclaration (the ones after the
parameter list)
      - for the type of a SingleVariableDeclaration (the ones after the
variable)

(Note that there is no confusion with field declarations and regular local
variable declarations, which are represented partly with
VariableDeclaratrionFragment nodes and do not have this confusion).

The 2.0 API does not clearly state what happens to the extra array
dimensions. In the 2.0 implementation, the extra array dimensions are built
in to the type but excluded from the type's source range. This has led to
much confusion (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=23284)

Not addressing these, albeit obscure, cases does not seem wise because they
will be a source of obscure bugs in the future. So for 2.1 we propose
fixing the MethodDeclaration and SingleVariableDeclaration API as follows:
      - Add new API methods (get/setExtraArrayDimensions) for record the
number of extra array dimensions.
      - State that extra array dimensions are not included structurally in
the type.
      - State that extra array dimensions are not included in the source
range of the type.

Implementing these changes would break existing clients that are depending
explicitly on certain readings of the current API contract, or ones
implicitly relying on the currently implemented behavior.

Before proceeding, we want to hear from others on the potential impact of
this change.

---jeem

_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev






Back to the top