You need to make the MyFilter project dependent on the API Utilities module. And you need to change the code from
package org.demo.myfilter;
import org.demo.textfilter.TextFilter;
@ServiceProvider(service=TextFilter.class)
public class UpperCaseFilter implements TextFilter {
public String process(String s) {
return s.toUpperCase();
}
}
at
package org.demo.myfilter;
import org.demo.textfilter.TextFilter;
import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service=TextFilter.class)
public class UpperCaseFilter implements TextFilter {
public String process(String s) {
return s.toUpperCase();
}
}
Note. If you add the module dependency first, you can use the Fix Imports element in the Source menu (CTRL-SHIFT-I / Clover-SHIFT-I) to automatically take care of the second.
source
share