How do I create a concrete instance of FileReference?

I’m manually adding javadoc elements to a few entries of a classpath file generated by the eclipseClasspath task.

I’ve can easily locate the proper library that I need to add the doc element too, but the javadocPath property of the Library class is of type FileReference, which is an interface.

I can’t find any example of classes that implement the FileReference interface in the platform, what is proper way to set this property?

eclipse {
 classpath {
  file {
   whenMerged { classpath ->
       for (entry in classpath.entries)
        if (entry.path.endsWith('gwt-dispatch-1.2.0.jar'))
      entry.javadocPath = ?
   }
  }
 }
}

I’m not aware of a good solution. In the past I’ve used the XML hook to work around this. I’ve created GRADLE-2853 for this.

Thanks, Peter.

As a work around, I’ve discovered that you can create an instance of FileReference on the fly if you’re willing to use the FileReferenceFactory from the internal namespace.

I’m assuming that the FileReferenceFactory isn’t part of the public API, but it’s working in a pinch.

import org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory
  eclipse {
 classpath {
  file {
   whenMerged { classpath ->
          for (entry in classpath.entries) {
       if (entry instanceof Library) {
      if (entry.path.endsWith('gwt-dispatch-1.2.0.jar')) {
        entry.javadocPath = new FileReferenceFactory().fromJarURI('file:/resource/listhub/docs/lib/gwt-dispatch-1.2.0-javadoc.jar!/')
      }
     }
                                }
                           }
                     }
             }
  }