private static StubElement<?> createStub(LighterAST tree, LighterASTNode element, StubElement<?> parentStub) {
    IElementType elementType = element.getTokenType();
    if (elementType instanceof IStubElementType) {
      if (elementType instanceof ILightStubElementType) {
        ILightStubElementType<?, ?> lightElementType = (ILightStubElementType<?, ?>)elementType;
        if (lightElementType.shouldCreateStub(tree, element, parentStub)) {
          return lightElementType.createStub(tree, element, parentStub);
        }
      }
      else {
        LOG.error("Element is not of ILightStubElementType: " + objectInfo(elementType) + ", " + element);
      }
    }

    return parentStub;
  }
private static StubElement<?> createStub(LighterAST tree, LighterASTNode element, StubElement<?> parentStub)