Skip to content

Commit

Permalink
# fixed nullpointer
Browse files Browse the repository at this point in the history
  • Loading branch information
sbra0902 committed May 29, 2020
1 parent 18b9ee9 commit 45ff6f0
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class EBeanModel(scope: EBean.Scope, sourceElement: Element) {

init {
var meta = sourceElement?.getAnnotation(Metadata::class.java)
kotlinClassMetadata = (KotlinClassMetadata.read(KotlinClassHeader(meta.kind, meta.metadataVersion, meta.bytecodeVersion, meta.data1, meta.data2, meta.extraString, meta.packageName, meta.extraInt)) as? KotlinClassMetadata.Class)?.toKmClass()
kotlinClassMetadata = if(meta != null){
(KotlinClassMetadata.read(KotlinClassHeader(meta.kind, meta.metadataVersion, meta.bytecodeVersion, meta.data1, meta.data2, meta.extraString, meta.packageName, meta.extraInt)) as? KotlinClassMetadata.Class)?.toKmClass()
}else{
null
}
}

val scope: EBean.Scope = scope
Expand All @@ -40,16 +44,16 @@ class EBeanModel(scope: EBean.Scope, sourceElement: Element) {
val generatedClazzTypeName: TypeName
get() = ClassName(`package`, generatedClazzSimpleName)

val classVisibility : KModifier
get() {
// we are not interested in other visibilities since they're not injectable
kotlinClassMetadata?.let {
if(Flag.IS_INTERNAL(kotlinClassMetadata?.flags)){
return KModifier.INTERNAL
val classVisibility: KModifier
get() {
// we are not interested in other visibilities since they're not injectable
kotlinClassMetadata?.let {
if (Flag.IS_INTERNAL(kotlinClassMetadata?.flags)) {
return KModifier.INTERNAL
}
}
return KModifier.PUBLIC
}
return KModifier.PUBLIC
}


}

0 comments on commit 45ff6f0

Please sign in to comment.