X10
  1. X10
  2. XTENLANG-990

Null pointer exception in X10DocProvider

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: X10 2.0.2
    • Fix Version/s: X10 2.0.3
    • Component/s: X10DT Source Editor
    • Labels:
      None
    • Environment:
      win/cygwin
    • Number of attachments :
      0

      Description

      When I hover, or click anywhere on the line declaring the field: "var f: Hello;", I get the following exception:

      Universal Editor Error
      java.lang.NullPointerException
      at org.eclipse.imp.x10dt.ui.editor.X10DocProvider.getHelpForEntity(X10DocProvider.java:316)
      at org.eclipse.imp.x10dt.ui.editor.X10DocProvider.getDocumentation(X10DocProvider.java:85)
      at org.eclipse.imp.editor.HoverHelper.getHoverHelpAt(HoverHelper.java:86)
      at org.eclipse.imp.editor.internal.HoverHelpController.getHoverInfo(HoverHelpController.java:59)
      at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:168)

      The code is the following. Note that this problem occurs only when there is a compilation error (line "h = "). But not all compilation errors produce this behavior.

      Hello.x10
      import x10.io.Console; 
      
      public class Hello {
      	var f: Hello;
          
          public static def main(args:Rail[String]!){
               if(args.length>0){
                 Console.OUT.println("The first arg is: "+args(0));
               } 
               Console.OUT.println("Hello X10 world ");
               val h = new Hello();  // final variable 
               var result : Boolean = h.myMethod(); // mutable variable 
               h = 
               Console.OUT.println("The answer is: "+result);
          } 
          /** x10doc comment for myMethod */;
          public def myMethod()=true;
      }
      
      

        Issue Links

          Activity

          Hide
          Robert M. Fuhrer added a comment -

          This seems to be a problem regardless of whether there's a compilation error. I'm running X10DT from HEAD of SVN trunk, and I get the error in a cleanly-compiling editor source buffer, pretty much no matter where I click.

          Show
          Robert M. Fuhrer added a comment - This seems to be a problem regardless of whether there's a compilation error. I'm running X10DT from HEAD of SVN trunk, and I get the error in a cleanly-compiling editor source buffer, pretty much no matter where I click.
          Robert M. Fuhrer made changes -
          Field Original Value New Value
          Component/s X10DT [ 13493 ]
          Component/s X10DT Source Editor [ 14343 ]
          Fix Version/s X10 2.0.3 [ 16215 ]
          David Grove made changes -
          Affects Version/s X10DT 2.0.1.1 [ 16184 ]
          Affects Version/s X10 2.0.2 [ 16023 ]
          Robert M. Fuhrer made changes -
          Assignee Mandana Vaziri [ mvaziri ]
          Hide
          Mandana Vaziri added a comment -

          This bug happens when there is a compilation error. Since we don't have error recovery yet, I added a catch clause to make the NPE silently go away for now. So Hover Help now does not work in the presence of compilation errors.

          Revision 13586.

          Show
          Mandana Vaziri added a comment - This bug happens when there is a compilation error. Since we don't have error recovery yet, I added a catch clause to make the NPE silently go away for now. So Hover Help now does not work in the presence of compilation errors. Revision 13586.
          Mandana Vaziri made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Mandana Vaziri added a comment -

          To respond to Bob's comment above:

          A different fix to the Hover Help fixed the problem of throwing NPEs when there are no compilation errors.

          Show
          Mandana Vaziri added a comment - To respond to Bob's comment above: A different fix to the Hover Help fixed the problem of throwing NPEs when there are no compilation errors.
          Hide
          Mandana Vaziri added a comment -

          Re-opening issue – The specification for Hover Help is to provide partial correct information in the presence of compilation errors. So in a circumstance where an NPE is normally thrown, we need to figure what information exists on a case by case basis to see what kind of partial information could be safely given to the user.

          This specification also implies that the integration of X10Doc with Hover Help is not as straightforward as I had initially thought. The refactoring of X10Doc to provide an API for getting doc programmatically will now need therefore to support partial information.

          Show
          Mandana Vaziri added a comment - Re-opening issue – The specification for Hover Help is to provide partial correct information in the presence of compilation errors. So in a circumstance where an NPE is normally thrown, we need to figure what information exists on a case by case basis to see what kind of partial information could be safely given to the user. This specification also implies that the integration of X10Doc with Hover Help is not as straightforward as I had initially thought. The refactoring of X10Doc to provide an API for getting doc programmatically will now need therefore to support partial information.
          Mandana Vaziri made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Mandana Vaziri added a comment -

          NPEs in Hover Help are caused by a bug in the front end: the type checker does not set the AST appropriately in the presence of semantic compilation errors. So the AST retrieved by the Parse Controller is missing a lot of type information. (XTENLANG-1219)

          Show
          Mandana Vaziri added a comment - NPEs in Hover Help are caused by a bug in the front end: the type checker does not set the AST appropriately in the presence of semantic compilation errors. So the AST retrieved by the Parse Controller is missing a lot of type information. ( XTENLANG-1219 )
          Mandana Vaziri made changes -
          Link This issue depends upon XTENLANG-1219 [ XTENLANG-1219 ]
          Hide
          Robert M. Fuhrer added a comment -

          Now traps NPE's as it used to.

          Show
          Robert M. Fuhrer added a comment - Now traps NPE's as it used to.
          Robert M. Fuhrer made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          David Grove added a comment -

          bulk close of resolved issues in 2.0.3.

          Show
          David Grove added a comment - bulk close of resolved issues in 2.0.3.
          David Grove made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Mandana Vaziri
              Reporter:
              Mandana Vaziri
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: