com.github.frimtec:import-control-demo-module-b

Import control annotation to use for lightweight module system in Java.

License

License

GroupId

GroupId

com.github.frimtec
ArtifactId

ArtifactId

import-control-demo-module-b
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Import control annotation to use for lightweight module system in Java.

Download import-control-demo-module-b

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.frimtec/import-control-demo-module-b/ -->
<dependency>
    <groupId>com.github.frimtec</groupId>
    <artifactId>import-control-demo-module-b</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.frimtec/import-control-demo-module-b/
implementation 'com.github.frimtec:import-control-demo-module-b:1.1.1'
// https://jarcasting.com/artifacts/com.github.frimtec/import-control-demo-module-b/
implementation ("com.github.frimtec:import-control-demo-module-b:1.1.1")
'com.github.frimtec:import-control-demo-module-b:jar:1.1.1'
<dependency org="com.github.frimtec" name="import-control-demo-module-b" rev="1.1.1">
  <artifact name="import-control-demo-module-b" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.frimtec', module='import-control-demo-module-b', version='1.1.1')
)
libraryDependencies += "com.github.frimtec" % "import-control-demo-module-b" % "1.1.1"
[com.github.frimtec/import-control-demo-module-b "1.1.1"]

Dependencies

compile (1)

Group / Artifact Type Version
com.github.frimtec : import-control-demo-module-a jar 1.1.1

Project Modules

There are no modules declared in this project.

Import Control

Maven Central codecov license

Build Deploy release

Import control annotation to use for lightweight module system in Java.

Motivation

Java previous to JDK 9 has a visibility concept that does not support modules very well. If modules are structured into various packages, and only dedicated packages should be exported to other modules, the visibilty modifiers do not fit at all. All public classes can be imported to other modules.
With JDK 9 JPMS was introduced to solve this issue. Using JPMS in a project is not an easy task and sometimes even not possible due to runtime restrictions (see jpms-negative-benefits). This is where Import Control comes to rescue. It fully supports the need for import control between modules but with no runtime impact nor restrictions. Packages of modules that shall be exported to other modules can be annotated with @ExportPackage. Your IDE can control whether your imports are correct or not.

How to use

In your projects modules, annotate the packages of modules that should be exported to other modules with the annotation com.github.frimtec.libraries.importcontrol.api.ExportPackage. To annotate a package create a package-info.java file inside the package folder with the following content:

@ExportPackage
package org.organisation.project.module;

IDE-Integration

IntelliJ-IDEA

Install the plugin IDEA Import Control to add a new code inspection rule that marks all undesirable imports as errors.

Add dependency

To use import-control in your project you can add the dependency from maven central to your software project management tool: In Maven just add the following dependency to your pom.xml:

      <dependency>
        <groupId>com.github.frimtec</groupId>
        <artifactId>import-control-api</artifactId>
        <version>1.1.1</version>
      </dependency>

Versions

Version
1.1.1
1.1.0