I have a project with a single source file, which is listed here in its entirety:
package com.acme.el; public class ExpressionUtils { public static Object evaluate() { new org.apache.commons.el.ExpressionEvaluatorImpl(); return null; } }
Functionality is not relevant. When I create a project as an OSGi package using Gradle, the manifest contains the following command:
Export-Package: com.acme.el;uses:="org.apache.commons.el";version="1.0"
What puzzles me is the uses directive. Since I understood the directive, it is intended to determine dependencies on other packages that need to be distributed in other packages importing this exported package - for example, if my class definitions or method signatures refer to classes in the org.apache.commons.el package, for example . But in this class, the dependency on org.apache.commons.el completely contained within the body of the method. It does not appear in the API, and no other package importing com.acme.el can ever get the ExpressionEvaluatorImpl instance created in the method. So the addiction should not be spread, right?
Did I not understand the meaning of the uses directive, or is it not necessary to use it here?
I made a minimal GitHub repository for playback that can be cloned and imported as a Gradle project in Eclipse.
source share