Skip to content

Commit

Permalink
fix: #316 Latest supported version should be decided based on runtime…
Browse files Browse the repository at this point in the history
… java version. Optional<byte[]> issue fixed (#321)
  • Loading branch information
satran004 authored Sep 6, 2023
1 parent cad6072 commit 63bc980
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Annotation processor for Plutus Constr annotation. This annotation processor generates the Serilizer and Deserializer code
* for the Constr annotated classes.
*/
@SupportedSourceVersion(SourceVersion.RELEASE_11)

@AutoService(Processor.class)
@Slf4j
public class ConstrAnnotationProcessor extends AbstractProcessor {
Expand All @@ -47,6 +47,11 @@ public Set<String> getSupportedAnnotationTypes() {
return annotataions;
}

@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latestSupported();
}

@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (TypeElement annotation : annotations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ private TypeName bestGuess(String name) {
return ClassName.get(Integer.class);
else if ("long".equals(name))
return ClassName.get(Long.class);
else if ("byte[]".equals(name))
return ArrayTypeName.of(TypeName.BYTE);
else
return ClassName.bestGuess(name);
}
Expand Down
1 change: 1 addition & 0 deletions annotation-processor/src/test/resources/Model1.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Model1 {
Optional<Integer> optInt;
Optional<Model2> optMod2;
Optional<Long> optionalLong;
Optional<byte[]> bytes;

@Enc("hex")
private String str;
Expand Down

0 comments on commit 63bc980

Please sign in to comment.