On Oct 19, 2007, at 5:47 AM, Luis Diego Fallas wrote:
Hi Everyone,
As an experiment I was trying to create a new Ruby Hint from a new module. In order to do that I'm inheriting from org.netbeans.modules.ruby.hints.spi.AstRule however it seems that this class can only be acceded from a module that is a friend of org-netbeans-modules-ruby-hints.jar .
By reading the module's project(http://deadlock.netbeans.org/hudson/job/ruby/ws/ruby/hints/nbproject/project.xml ) , only two modules are friends(extrahints and cmdline) of org-netbeans-modules-ruby-hints.jar.
Is there any other class which I can use to implement a Ruby Hint?
Are there any plans to make org-netbeans-modules-ruby-hints.jar available for other modules ?
Hi Luis,
yes, but not in 6.0. The reason the module does not expose a public API yet (and therefore requires either implementation dependencies or friend status) is that the API is not considered final. It hasn't gone through API reviews yet, and in particular, I'm still thinking it needs some changes. For example, I think a number of hints will want to decide whether they apply or not based on the project type. Rather than having all of them recompute the current project, I want to pass in a map of some common attributes that the modules can look up.
There is a simple way to deal with this. Declare an -implementation- dependency on the hints module. This means that your module will be tied to the specific implementation version of the hints module you're using (the build timestamp, not the specification version). This lets you access all the private APIs; the only downside is that it's tied to that version and that version only. You'll need to rebuild whenever you update the hints module. If you get further along and want your hints to be working via auto updates for new versions of the IDE, let me know and I can add your module name as a friend. Better yet, when you have something working, if the hint is of general interest perhaps you can contribute it to the extrahints module?
To add an implementation dependency, use this:
<dependency>
<code-name-base>org.netbeans.modules.ruby.hints</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<implementation-version/>
</run-dependency>
</dependency>
(E.g. <implementation-version/> instead of <specification-version>)
-- Tor