import-control

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

Лицензия

Лицензия

Группа

Группа

com.github.frimtec
Идентификатор

Идентификатор

import-control
Последняя версия

Последняя версия

1.1.1
Дата

Дата

Тип

Тип

pom
Описание

Описание

import-control
Import control annotation to use for lightweight module system in Java.
Ссылка на сайт

Ссылка на сайт

https://github.com/frimtec/import-control
Система контроля версий

Система контроля версий

https://github.com/frimtec/import-control

Скачать import-control

Имя Файла Размер
import-control-1.1.1.pom 10 KB
Обзор

Как подключить последнюю версию

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

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

  • import-control-api
  • import-control-demo

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>

Версии библиотеки

Версия
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0