@@ -73,22 +73,25 @@ internal class MetadataParser(resolver: Resolver, environment: SymbolProcessorEn
7373 }
7474
7575 fun parseTableMetadata (cls : KSClassDeclaration ): TableMetadata {
76- val r = _tablesCache [cls.qualifiedName!! .asString()]
76+ val className = cls.qualifiedName!! .asString()
77+ val r = _tablesCache [className]
7778 if (r != null ) {
7879 return r
7980 }
8081
8182 if (cls.classKind != CLASS && cls.classKind != INTERFACE ) {
82- val name = cls.qualifiedName!! .asString()
83- throw IllegalStateException (" $name is expected to be a class or interface but actually ${cls.classKind} ." )
83+ throw IllegalStateException (" $className should be a class or interface but actually ${cls.classKind} ." )
8484 }
8585
8686 if (cls.classKind == INTERFACE && ! cls.isSubclassOf<Entity <* >>()) {
87- val name = cls.qualifiedName!! .asString()
88- throw IllegalStateException (" $name must extend from org.ktorm.entity.Entity." )
87+ throw IllegalStateException (" $className must extend from org.ktorm.entity.Entity." )
8988 }
9089
91- _logger .info(" [ktorm-ksp-compiler] parse table metadata from entity: ${cls.qualifiedName!! .asString()} " )
90+ if (cls.classKind == CLASS && cls.isAbstract()) {
91+ throw IllegalStateException (" $className cannot be an abstract class." )
92+ }
93+
94+ _logger .info(" [ktorm-ksp-compiler] parse table metadata from entity: $className " )
9295 val table = cls.getAnnotationsByType(Table ::class ).first()
9396 val tableDef = TableMetadata (
9497 entityClass = cls,
@@ -111,7 +114,7 @@ internal class MetadataParser(resolver: Resolver, environment: SymbolProcessorEn
111114 }
112115 }
113116
114- _tablesCache [cls.qualifiedName !! .asString() ] = tableDef
117+ _tablesCache [className ] = tableDef
115118 return tableDef
116119 }
117120
0 commit comments