Bug 22951 - Type binding "null" for super method invocations in VariableDeclarationFragment initializer
Summary: Type binding "null" for super method invocations in VariableDeclarationFragme...
Status: RESOLVED DUPLICATE of bug 22054
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 2.1 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-28 13:20 EDT by Timothy Halloran CLA
Modified: 2003-03-23 12:15 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Halloran CLA 2002-08-28 13:20:26 EDT
I'm getting type binding problems for super method invocations within the
initializer expression of a VariableDeclarationFragment, I am unsure if this
occurs in general expressions.  Below are some examples:

[PVAVariableDeclarationAndUse] null rhs type in Initializer
"ds=super.getDirectoryScanner(srcDir)" in file
/home/thallora/src/jakarta-ant-1.5/src/main/org/apache/tools/ant/taskdefs/Copydir.java
[PVAVariableDeclarationAndUse] null rhs type in Initializer
"ds=super.getDirectoryScanner(dir)" in file
/home/thallora/src/jakarta-ant-1.5/src/main/org/apache/tools/ant/taskdefs/Delete.java
[PVAVariableDeclarationAndUse] null rhs type in Initializer
"ds=super.getDirectoryScanner(srcDir)" in file
/home/thallora/src/jakarta-ant-1.5/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java

Here's the code snippit:

  void saveVariable(VariableDeclarationFragment node) {
    if (isNull(node,
      "null VariableDeclarationFragment passed to saveVariable()")) {
      return;
    }
    IVariableBinding variable = node.resolveBinding();
    if (isNull(variable,
      "null variable in VariableDeclarationFragment \"" + node + "\"")) {
      return;
    }
    ITypeBinding type = variable.getType();
    if (isNull(type,
      "null type in VariableDeclarationFragment \"" + node + "\"")) {
      return;
    }
    // declare the variable (it may already have been encountered)
    f_db.declareVariable(variable, type, toJEM(node));

*   // since we are interested in this variable check the initializer
*   Expression initializer = node.getInitializer();
*   if (initializer == null) {
*     return; // no initializer
*   }
*   ITypeBinding rhsType = initializer.resolveTypeBinding();
*   if (isNull(rhsType, "null rhs type in Initializer \"" + node + "\"")) {
*     return;
*   }
    IVariableBinding rhsVar = expressionToVariable(initializer);
    if (rhsVar == null) {
      // some kind of expression we are not interested in
      return;
    }
    f_db.addToAssignmentSignature(type, rhsVar, rhsType, toJEM(node));
  }

I'm expected the expression type to be returned, hence it looks like a but in
the type binder code.

Thoughts?

Take Care,
Tim Halloran
Carnegie Mellon University
Comment 1 Timothy Halloran CLA 2002-08-28 13:23:40 EDT
I am spotting them in Assigments as well, hence this appears to be a general
expression issue:

[PVAVariableDeclarationAndUse] null rhs type in Assignment
"e=super.getAnnotationIterator()" in file
/home/thallora/src/eclipse20/plugins/org.eclipse.ui/Eclipse JFace
Text/org/eclipse/jface/text/source/VisualAnnotationModel.java
Comment 2 Adam Kiezun CLA 2002-08-29 03:47:46 EDT
dup of bug 22054 ?
Comment 3 Timothy Halloran CLA 2002-08-29 13:18:56 EDT
Yes, looks like a duplicate, I missed it because it doesn't refer to the API, it
is a more abstract report of the same problem (e.g., as seen through the
refactoring user interface).  Good catch Adam!

Take Care,
Tim Halloran
Carnegie Mellon University



*** This bug has been marked as a duplicate of 22054 ***