bump annotation processors to java 17

This commit is contained in:
Daniel Gultsch 2023-03-10 20:03:32 +01:00
parent 58c5bd0f1b
commit 97f54b6673
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
3 changed files with 9 additions and 9 deletions

View file

@ -1,14 +1,15 @@
apply plugin: "java-library" apply plugin: "java-library"
java { java {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
dependencies { dependencies {
implementation project(':annotation') implementation project(':annotation')
annotationProcessor 'com.google.auto.service:auto-service:1.0.1' annotationProcessor 'com.google.auto.service:auto-service:1.0.1'
compileOnly 'com.google.auto.service:auto-service:1.0.1' api 'com.google.auto.service:auto-service-annotations:1.0.1'
implementation 'com.google.guava:guava:31.1-jre'
} }

View file

@ -23,7 +23,7 @@ import javax.lang.model.element.TypeElement;
import javax.tools.JavaFileObject; import javax.tools.JavaFileObject;
@AutoService(Processor.class) @AutoService(Processor.class)
@SupportedSourceVersion(SourceVersion.RELEASE_11) @SupportedSourceVersion(SourceVersion.RELEASE_17)
@SupportedAnnotationTypes("im.conversations.android.annotation.XmlElement") @SupportedAnnotationTypes("im.conversations.android.annotation.XmlElement")
public class XmlElementProcessor extends AbstractProcessor { public class XmlElementProcessor extends AbstractProcessor {
@ -31,10 +31,9 @@ public class XmlElementProcessor extends AbstractProcessor {
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) { public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
final Set<? extends Element> elements = final Set<? extends Element> elements =
roundEnvironment.getElementsAnnotatedWith(XmlElement.class); roundEnvironment.getElementsAnnotatedWith(XmlElement.class);
final ImmutableMap.Builder<Id, String> builder = ImmutableMap.<Id, String>builder(); final ImmutableMap.Builder<Id, String> builder = ImmutableMap.builder();
for (final Element element : elements) { for (final Element element : elements) {
if (element instanceof TypeElement) { if (element instanceof final TypeElement typeElement) {
final TypeElement typeElement = (TypeElement) element;
final Id id = of(typeElement); final Id id = of(typeElement);
builder.put(id, typeElement.getQualifiedName().toString()); builder.put(id, typeElement.getQualifiedName().toString());
} }

View file

@ -1,6 +1,6 @@
apply plugin: "java-library" apply plugin: "java-library"
java { java {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }