Skip to content

Commit

Permalink
Merge branch 'release/2.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins committed Jun 1, 2023
2 parents 7ba6aea + 886abf6 commit 7593544
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 20 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- This file is auto generated during release from readme/README.md -->

[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=2.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.0/jar)
[![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=2.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.0)
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=2.3.1&color=blue)](https://search.maven.org/artifact/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.1/jar)
[![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=2.3.1&color=orange)](http://www.javadoc.io/doc/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.1)
[![Coverage Status](https://coveralls.io/repos/github/skuzzle/restrict-imports-enforcer-rule/badge.svg?branch=master)](https://coveralls.io/github/skuzzle/restrict-imports-enforcer-rule?branch=master)
[![Twitter Follow](https://img.shields.io/twitter/follow/skuzzleOSS.svg?style=social)](https://twitter.com/skuzzleOSS)

Expand All @@ -26,7 +26,7 @@ information.
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
</dependencies>
<executions>
Expand Down
12 changes: 3 additions & 9 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=2.3.0&color=blue)](https://search.maven.org/artifact/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.0/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=2.3.0&color=orange)](http://www.javadoc.io/doc/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.0)
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=2.3.1&color=blue)](https://search.maven.org/artifact/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.1/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=2.3.1&color=orange)](http://www.javadoc.io/doc/de.skuzzle.enforcer/restrict-imports-enforcer-rule/2.3.1)

### Bug fixes
* [#73](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/73) Classloader issues while locating LanguageSupport instances
* [#76](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/76) `**` wildcard must match at least a single package part

### Misc
* Updated various dependencies


* [#79](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/79) Recognize full qualified annotation use

Maven Central coordinates for this release:

```xml
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
```
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
<packaging>jar</packaging>
<name>Restrict Imports Enforcer Rule</name>
<description>Bans imports of specified classes/packages</description>
Expand Down
8 changes: 1 addition & 7 deletions readme/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
[![Maven Central](https://img.shields.io/static/v1?label=MavenCentral&message=${project.version}&color=blue)](https://search.maven.org/artifact/${project.groupId}/${project.artifactId}/${project.version}/jar) [![JavaDoc](https://img.shields.io/static/v1?label=JavaDoc&message=${project.version}&color=orange)](http://www.javadoc.io/doc/${project.groupId}/${project.artifactId}/${project.version})

### Bug fixes
* [#73](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/73) Classloader issues while locating LanguageSupport instances
* [#76](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/76) `**` wildcard must match at least a single package part

### Misc
* Updated various dependencies


* [#79](https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/79) Recognize full qualified annotation use

Maven Central coordinates for this release:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.expr.FieldAccessExpr;
import com.github.javaparser.ast.expr.MarkerAnnotationExpr;
import com.github.javaparser.ast.expr.MethodCallExpr;
import com.github.javaparser.ast.nodeTypes.NodeWithType;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
Expand Down Expand Up @@ -79,6 +80,14 @@ private Optional<ImportStatement> nodeToImportStatement(Node node) {

return Optional.of(new ImportStatement(accessExpr.getScope() + "." + accessExpr.getName(),
positionOf(node), ImportType.QUALIFIED_TYPE_USE));
} else if (node instanceof MarkerAnnotationExpr) {
final MarkerAnnotationExpr expr = (MarkerAnnotationExpr) node;
final boolean isQualified = expr.getName().getQualifier().isPresent();

if (isQualified) {
return Optional.of(
new ImportStatement(expr.getNameAsString(), positionOf(node), ImportType.QUALIFIED_TYPE_USE));
}
}

return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ void testAnalyzeFallbackOnFailure(@TempDir Path tempDir) throws IOException {
// fallback parsing also failed
}

@Test
void testFullQualifiedAnnotationUsage(@TempDir Path tempDir) throws Exception {
final Path sourceFile = tempSourceFile(tempDir, "Filename.java",
"class Test {",
" @a.b.c.Annotation",
" @Override",
" String foo(int parameter) {",
" return null;",
" }",
"}");
final boolean parseFullCompilationUnit = true;
final ImportStatementParser subject = ImportStatementParser.forCharset(StandardCharsets.UTF_8,
parseFullCompilationUnit);
final ParsedFile parsedFile = subject.parse(sourceFile);
assertThat(parsedFile.getImports()).containsOnly(
new ImportStatement("a.b.c.Annotation", 2, ImportType.QUALIFIED_TYPE_USE));
}

@Test
void testAnalyzeInlineFullQualifiedClassUsage(@TempDir Path tempDir) throws Exception {
final Path sourceFile = tempSourceFile(tempDir, "Filename.java",
Expand Down

0 comments on commit 7593544

Please sign in to comment.