groovy/groovy-eclipse — pull request #107 by BoykoAlex (2014-12-17 17:47:16+00:00)
Title: Handle Traits code completion NPE

TraitsASTTransformation goes through traits and creates a helper inner class node for each of them and fills it with method node created based on initial class node method nodes. Difference is in #processMethodNode(MethodNode) method. This method also sets the code property of the initial method node to null (hence the NPE in completion assist). The idea behind it i guess is that for the helper inner class node method nodes to have the data.
Code completion visitor gets to the method node and requires method node's code field not to be null. If we add a null check suppport around the code generating the NPE then ideally we should not only avoid throwing NPE, but also fix CA. There is an InnerClassNode helper for a trait along with the initial ClassNode that has the corresponding method nodes with non-null, valid "code" property that will be examined next.