#org.reflections problem

1 messages · Page 1 of 1 (latest)

wild jetty
#
val reflections = Reflections("com.nebuliks.backend.models.generated")
        val classes = reflections.getSubTypesOf(Obect.class)
        println(classes)

why this didnt work ?

desert fieldBOT
#

<@&1008423204219531294> please have a look, thanks.

shut ruin
#

why this didnt work ?
this really isnt a good description of your problem

#

what exactly doesnt work?

#

any error message?

#

best to put some effort into asking a question

#

then it is easier for others to help

wild jetty
#

it printed []

silk egret
#

then apparently such a class didnt exist in ur build path

wild jetty
#

i have 4 kotlin classes in generated package

silk egret
#

does it work if u put a different class and package in there?

#

for example for sth that is in the sdk

wild jetty
silk egret
#

try it first with something from the sdk

#

potentially u are just misusing the api

wild jetty
#

...

silk egret
#

why the "..."?

wild jetty
#

you didnt give me any hint or something to do

silk egret
#

does it work if u put a different class and package in there?
for example for sth that is in the sdk

#

please do that

wild jetty
#

ok

silk egret
#

also, where is that Reflections from? kotlin-reflect?

#

when u wrote Obect.class i guess u did a typo and meant Object.class?

#

(it shouldnt compile then though)

#

so it looks like u didnt share ur real code with us

wild jetty
#

i tried ity with Object.clas and it didnt work

#

the code i currently have is

val reflections = Reflections("com.nebuliks.backend.models.generated")
        val classes = reflections.getSubTypesOf(Any::class.java)
        println(classes)
desert fieldBOT
silk egret
#

okay

wild jetty
#

also : the sdk worked and loaded the class correctly

silk egret
#

can u share the example with the sdk code please

wild jetty
#

and Reflection is from org.reflections package

#

@Test
fun loadGeneratedClass() {
val fqcn = "com.nebuliks.backend.models.generated.Actors"
val clazz = Class.forName(fqcn) // Java reflection
print(clazz) // convert to Kotlin KClass
}

silk egret
#

ah, thats not what i meant actually

#

i meant to try it out looking for classes in a sdk package

#

for example look for java.util

#

instead of ur custom package

#

cause if that doesnt work either then the problem is not ur custom code but the way u use that org-reflections code

#

potentially ur just misundestanding the org.reflections api then

wild jetty
#

hmm i will see

#

it didnt work with java.util

#

i will see the api again then

wild jetty