No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
6671816
... +0 ...
9228301
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
19 | 19 | package org.derive4j.processor; |
|
20 | 20 | ||
21 | 21 | import com.google.auto.service.AutoService; |
|
22 | + | import com.squareup.javapoet.AnnotationSpec; |
|
22 | 23 | import com.squareup.javapoet.ClassName; |
|
23 | 24 | import com.squareup.javapoet.JavaFile; |
|
24 | 25 | import com.squareup.javapoet.MethodSpec; |
104 | 105 | ||
105 | 106 | deriveConfigBuilder = new DeriveConfigBuilder(processingEnv.getElementUtils()); |
|
106 | 107 | ||
107 | - | deriveUtils = new DeriveUtilsImpl(processingEnv.getElementUtils(), processingEnv.getTypeUtils(), |
|
108 | + | deriveUtils = new DeriveUtilsImpl( |
|
109 | + | processingEnv.getElementUtils(), |
|
110 | + | processingEnv.getTypeUtils(), |
|
111 | + | processingEnv.getSourceVersion(), |
|
108 | 112 | deriveConfigBuilder); |
|
109 | 113 | builtinDerivator = BuiltinDerivator.derivator(deriveUtils); |
|
110 | 114 | adtParser = new AdtParser(deriveUtils); |
223 | 227 | .addFields(getFields(codeSpec)) |
|
224 | 228 | .addMethods(getMethods(codeSpec)); |
|
225 | 229 | ||
230 | + | deriveUtils.generatedAnnotation() |
|
231 | + | .ifPresent(annotation -> builder.addAnnotation(AnnotationSpec.builder(ClassName.get(annotation)) |
|
232 | + | .addMember("value", "$S", getClass().getCanonicalName()) |
|
233 | + | .build())); |
|
234 | + | ||
226 | 235 | deriveConfig.targetClass().extend().ifPresent(cn -> { |
|
227 | 236 | if (deriveUtils.findTypeElement(cn).get().getKind().isInterface()) { |
|
228 | 237 | builder.addSuperinterface(cn); |
18 | 18 | */ |
|
19 | 19 | package org.derive4j.processor; |
|
20 | 20 | ||
21 | + | import com.google.auto.common.GeneratedAnnotations; |
|
21 | 22 | import com.squareup.javapoet.AnnotationSpec; |
|
22 | 23 | import com.squareup.javapoet.ClassName; |
|
23 | 24 | import com.squareup.javapoet.CodeBlock; |
42 | 43 | import java.util.stream.Collectors; |
|
43 | 44 | import java.util.stream.IntStream; |
|
44 | 45 | import java.util.stream.Stream; |
|
46 | + | import javax.lang.model.SourceVersion; |
|
45 | 47 | import javax.lang.model.element.ElementKind; |
|
46 | 48 | import javax.lang.model.element.ExecutableElement; |
|
47 | 49 | import javax.lang.model.element.Modifier; |
145 | 147 | ||
146 | 148 | private final Elements Elements; |
|
147 | 149 | private final Types Types; |
|
150 | + | private final SourceVersion SourceVersion; |
|
148 | 151 | private final DeriveConfigBuilder deriveConfigBuilder; |
|
149 | 152 | private final ObjectModel objectModel; |
|
150 | 153 |
153 | 156 | private final Function<Flavour, OptionModel> optionModel; |
|
154 | 157 | private final Function<Flavour, Optional<EitherModel>> eitherModel; |
|
155 | 158 | ||
156 | - | DeriveUtilsImpl(Elements Elements, Types Types, DeriveConfigBuilder deriveConfigBuilder) { |
|
159 | + | DeriveUtilsImpl( |
|
160 | + | Elements Elements, Types Types, SourceVersion SourceVersion, DeriveConfigBuilder deriveConfigBuilder) { |
|
157 | 161 | ||
158 | 162 | this.Elements = Elements; |
|
159 | 163 | this.Types = Types; |
|
164 | + | this.SourceVersion = SourceVersion; |
|
160 | 165 | this.deriveConfigBuilder = deriveConfigBuilder; |
|
161 | 166 | ||
162 | 167 | TypeElement object = Elements.getTypeElement(Object.class.getName()); |
383 | 388 | return asDeclaredType(typeMirror).map(DeclaredType::asElement).flatMap(asTypeElement::visit); |
|
384 | 389 | } |
|
385 | 390 | ||
391 | + | public Optional<TypeElement> generatedAnnotation() { |
|
392 | + | return GeneratedAnnotations.generatedAnnotation(Elements, SourceVersion); |
|
393 | + | } |
|
394 | + | ||
386 | 395 | @Override |
|
387 | 396 | public boolean isWildcarded(TypeMirror typeMirror) { |
|
388 | 397 | List<? extends TypeMirror> targs = asDeclaredType(typeMirror).map(DeclaredType::getTypeArguments) |
Files | Complexity | Coverage |
---|---|---|
annotation/src/main/java/org/derive4j | 100.00% | 85.10% |
processor-api/src/main/java/org/derive4j/processor/api | 82.96% | 69.56% |
processor/src/main/java/org/derive4j/processor | +2.00% 83.80% | 0.02% 91.64% |
Project Totals (56 files) | 83.75% | 89.99% |
#94
9228301
6671816