How to get a specific class from Groovy AST class ClassNode?

I created the AST Groovy annotation and transformation for her. This annotation applies only to classes. The conversion works at the SEMANTIC_ANALISIS stage and should create a new class. I need to get the concrete type (java.lang.Class) of an annotated Groovy class of ClassNode class. But if I try to call classNode.getTypeClass() in the conversion visiting method, then the exception "Getting ClassNode # getTypeClass for MyEntity is called before the type class is set" occurs at compile time. What is the correct way to get such information?

+5
source share

Source: https://habr.com/ru/post/1239170/


All Articles