Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasstamann committed Dec 18, 2023
2 parents f5f10db + 7cb0cc6 commit 4bc24ac
Show file tree
Hide file tree
Showing 42 changed files with 292 additions and 284 deletions.
2 changes: 1 addition & 1 deletion annotationwrapper/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-annotationwrapper-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-annotationwrapper-api</name>
Expand Down
2 changes: 1 addition & 1 deletion annotationwrapper/integrationtest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-annotationwrapper-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-annotationwrapper-integrationTest</name>
Expand Down
2 changes: 1 addition & 1 deletion annotationwrapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>


Expand Down
2 changes: 1 addition & 1 deletion annotationwrapper/processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-annotationwrapper-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-annotationwrapper-processor</name>
Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-common</name>
Expand Down
2 changes: 1 addition & 1 deletion compilermessages/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-compilermessages-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-compilermessages-api</name>
Expand Down
2 changes: 1 addition & 1 deletion compilermessages/integrationtest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-compilermessages-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-compilermessages-integrationTest</name>
Expand Down
2 changes: 1 addition & 1 deletion compilermessages/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>


Expand Down
2 changes: 1 addition & 1 deletion compilermessages/processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-compilermessages-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-compilermessages-processor</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import java.util.Optional;
import java.util.UUID;

public class CompilerMessageWrapperCustomCode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import io.toolisticon.aptk.compilermessage.api.DeclareCompilerMessage;
import io.toolisticon.aptk.compilermessage.api.DeclareCompilerMessageCodePrefix;

@DeclareCompilerMessage(processorClass = io.toolisticon.aptk.compilermessage.processor.test.TestClass.class, enumValueName = "ON_REMOTE_CLASS", code = "005", message = "TEST 5")
public class RemoteTestClass {
Expand Down
2 changes: 1 addition & 1 deletion cute/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-cute</name>
Expand Down
4 changes: 2 additions & 2 deletions example/example-annotationprocessor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-example-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-example-annotationprocessor</name>
Expand Down Expand Up @@ -43,7 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
2 changes: 1 addition & 1 deletion example/example-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-example-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-example-annotations</name>
Expand Down
2 changes: 1 addition & 1 deletion example/example-usecase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-example-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-example-usecase</name>
Expand Down
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-example-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion extensions/java9/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>extension-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-tools-java9</name>
Expand Down
2 changes: 1 addition & 1 deletion extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>extension-parent</name>
Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
<packaging>pom</packaging>

<name>aptk-parent</name>
Expand Down Expand Up @@ -93,18 +93,18 @@
<junit.version>4.13.2</junit.version>
<hamcrest.version>2.2</hamcrest.version>
<mockito.version>4.3.1</mockito.version>
<lombok.version>1.18.22</lombok.version>
<lombok.version>1.18.30</lombok.version>

<!-- sonatype url-->
<sonatype-oss-dist-mgmt-snapshots-url>https://oss.sonatype.org/content/repositories/snapshots/
</sonatype-oss-dist-mgmt-snapshots-url>


<!-- plugin versions -->
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<maven-assembly-plugin.version>3.6.0</maven-assembly-plugin.version>
<maven-build-helper-plugin.version>3.5.0</maven-build-helper-plugin.version>
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
<maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>3.3.2</maven-clean-plugin.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version>
<maven-deploy-plugin.version>3.1.0</maven-deploy-plugin.version>
Expand All @@ -116,10 +116,10 @@
<maven-install-plugin.version>3.1.0</maven-install-plugin.version>
<maven-jacoco-plugin.version>0.8.10</maven-jacoco-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
<maven-javadoc-plugin.version>3.6.2</maven-javadoc-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
<maven-shade-plugin.version>3.5.1</maven-shade-plugin.version>
<maven-site-plugin.version>3.12.1</maven-site-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>
Expand Down
2 changes: 1 addition & 1 deletion templating/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-templating</name>
Expand Down
2 changes: 1 addition & 1 deletion tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.aptk</groupId>
<artifactId>aptk-parent</artifactId>
<version>0.22.8</version>
<version>0.22.9</version>
</parent>

<name>aptk-tools</name>
Expand Down
38 changes: 18 additions & 20 deletions tools/src/main/java/io/toolisticon/aptk/tools/AnnotationUtils.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package io.toolisticon.aptk.tools;


import io.toolisticon.aptk.tools.wrapper.AnnotationMirrorWrapper;
import io.toolisticon.aptk.tools.wrapper.TypeElementWrapper;

import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
Expand Down Expand Up @@ -83,7 +80,7 @@ public static String[] getMandatoryAttributeValueNames(AnnotationMirror annotati
result.add(entry.getKey().getSimpleName().toString());
}
}
return result.toArray(new String[result.size()]);
return result.toArray(new String[0]);

}

Expand All @@ -107,7 +104,7 @@ public static String[] getOptionalAttributeValueNames(AnnotationMirror annotatio

/**
* Gets the AnnotationValue for the passed key.
* Also implicitly set default values will be found.
* Also, implicitly set default values will be found.
*
* @param annotationMirror the annotation mirror to get the value from
* @param key the attribute key to search for
Expand All @@ -124,8 +121,8 @@ public static AnnotationValue getAnnotationValueOfAttributeWithDefaults(Annotati


/**
* Gets the ExecutableElement of a annotation attribute for the passed key.
* This can be used to determine the type of an attribute.
* Gets the ExecutableElement of an annotation attribute for the passed key.
* This can be used to determine the type of the attribute.
* This is very useful if you want to generate code that uses the annotation.
*
* @param annotationMirror the annotation mirror to get the value from
Expand All @@ -144,7 +141,7 @@ public static ExecutableElement getExecutableElementForAnnotationAttributeName(A
}

/**
* Gets the a FQN of a Class based "value" attribute from annotation.
* Gets the FQN of a Class based "value" attribute from annotation.
*
* @param element the element to get the annotation for.
* @param annotationType the annotation type to get the FQN from
Expand All @@ -155,7 +152,7 @@ public static String getClassAttributeFromAnnotationAsFqn(Element element, Class
}

/**
* Gets the a FQN of a Class based attribute from annotation.
* Gets the FQN of a Class based attribute from annotation.
*
* @param element the element to get the annotation for.
* @param annotationType the annotation type to get the FQN from
Expand All @@ -171,7 +168,7 @@ public static String getClassAttributeFromAnnotationAsFqn(Element element, Class
}

/**
* Gets the a FQN of a Class based attribute from annotation.
* Gets the FQN of a Class based attribute from annotation.
*
* @param annotationMirror the AnnotationMirror to get the attribute from.
* @param attributeName the name of the attribute to get
Expand All @@ -186,7 +183,7 @@ public static String getClassAttributeFromAnnotationAsFqn(AnnotationMirror annot
}

/**
* Gets the a FQN of a Class based attribute from annotation.
* Gets the FQN of a Class based attribute from annotation.
*
* @param annotationMirror the AnnotationMirror to get the value attribute from.
* @return the FQN of the searched annotation value or null if annotation can't be found or attribute isn't of type class.
Expand All @@ -200,7 +197,7 @@ public static String getClassAttributeFromAnnotationAsFqn(AnnotationMirror annot
}

/**
* Gets the a TypeMirror of a Class based "value" attribute from annotation.
* Gets the TypeMirror of a Class based "value" attribute from annotation.
*
* @param element the element to get the annotation for.
* @param annotationType the annotation type to get the TypeMirror from
Expand All @@ -211,7 +208,7 @@ public static TypeMirror getClassAttributeFromAnnotationAsTypeMirror(Element ele
}

/**
* Gets the a TypeMirror of a Class based attribute from annotation.
* Gets the TypeMirror of a Class based attribute from annotation.
*
* @param element the element to get the annotation for.
* @param annotationType the annotation type to get the TypeMirror from
Expand All @@ -226,7 +223,7 @@ public static TypeMirror getClassAttributeFromAnnotationAsTypeMirror(Element ele
}

/**
* Gets the a TypeMirror of a Class based attribute from annotation.
* Gets the TypeMirror of a Class based attribute from annotation.
*
* @param annotationMirror the annotation mirror to get the TypeMirror from
* @param attributeName the name of the attribute to get
Expand Down Expand Up @@ -389,7 +386,8 @@ public static TypeMirror[] getClassArrayAttributeFromAnnotationAsTypeMirror(Anno

/**
* Checks if passed annotation is repeatable.
* (annotataed with Repeatable annotation)
* (annotated with Repeatable annotation)
*
* @param annotation the annotation to check
* @return true if the annotation is repeatable, otherwise false
*/
Expand All @@ -399,21 +397,22 @@ public static boolean isRepeatableAnnotation(Class<? extends Annotation> annotat

/**
* Gets the repeatable wrapper type of annotation
*
* @param annotation the annotation to get the repeatable annotation wrapper type for
* @return an optional containing the repeatable wrapper type or an empty optional if passed annotation is null or annotation is no repeatable.
*/
public static Optional<Class<? extends Annotation>> getRepeatableAnnotationWrapperClass(Class<? extends Annotation> annotation) {
if(isRepeatableAnnotation(annotation)) {
if (isRepeatableAnnotation(annotation)) {

TypeElement annotationTypeElement = TypeUtils.TypeRetrieval.getTypeElement(annotation);
AnnotationMirror annotationMirror = AnnotationUtils.getAnnotationMirror(annotationTypeElement, Repeatable.class);

TypeMirror typeMirror = getClassAttributeFromAnnotationAsTypeMirror(annotationMirror, "value");

try {
return Optional.of((Class<? extends Annotation>)Class.forName(typeMirror.toString()));
return Optional.of((Class<? extends Annotation>) Class.forName(typeMirror.toString()));
} catch (ClassNotFoundException e) {
// ignore - shouldn't happen since
// ignore - shouldn't happen since
}

}
Expand All @@ -422,7 +421,7 @@ public static Optional<Class<? extends Annotation>> getRepeatableAnnotationWrapp

public static Optional<List<AnnotationMirror>> getRepeatableAnnotation(Element element, Class<? extends Annotation> annotation) {

if (annotation == null || element == null || !isRepeatableAnnotation(annotation)) {
if (element == null || !isRepeatableAnnotation(annotation)) {
return Optional.empty();
}

Expand All @@ -447,5 +446,4 @@ public static Optional<List<AnnotationMirror>> getRepeatableAnnotation(Element e
}



}
Loading

0 comments on commit 4bc24ac

Please sign in to comment.