"Access restriction" error in Eclipse plugins

I spent quite a lot of time today trying to debug “Access restriction” error in one of my Eclipse plugins. In the last four years of Eclipse plugin development, I don’t recall ever facing this issue, but today suddenly some of the imports in one of the classes in my Eclipse plugin were flagged off as errors –

Access restriction: The type ISelection is not accessible due to restriction on required library <eclipse-path>\eclipse\plugins\org.eclipse.jface_3.6.1.M20100825-0800.jar

I had seen warnings about ‘restricted access’ for some of the imports earlier, but those were for classes that Eclipse discouraged to use e,g, for internal Eclipse classes. But today I was seeing errors.

The error does not tell much about what could have gone wrong. ISelection is exported from jface plugin and it is a public interface. And I had used this class without any error in other plugins.

Continue reading “"Access restriction" error in Eclipse plugins”