I'm playing with the infamous all-subprojects javadocs again, as my original 
changes for 0.9 ceased to function with preview release 3.

Arguably, I was not doing things the correct way in the first place, but it was 
interesting to discover why it no longer works.

alljavadoc.doFirst()
{
  Javadoc task ->
  task.project.subprojects.each  {
    Project subproject ->

    task.source = task.source + subproject.javadoc.source
    task.classpath = task.classpath + subproject.javadoc.classpath
  }
}

Now I get "Cause: Cannot invoke method plus() on null object"

Not sure if this is a DSL or groovy version change, or what.

Anyway, in attempting to find a uniform way of adding to the values, it seems 
that source and classpath are both set to null objects (at least as visible via 
the implicit get() methods).

Is there a reason that list-type objects are initialized to null (or in the 
case of source within SourceTask made to appear to be null) instead of treated 
as empty collections?  I suspect it might be for performance reasons, or maybe 
just a style reason, but it seems inconsistent with many other collections that 
are initialized to empty instead of null.

-Spencer


      

Reply via email to