#2412 Type.find - error for java classes with numbers in name

shturman Wed 22 Apr 2015

Type.find("[java]package::MyClass")

return [java]package::MyClass

Type.find("[java]package::MyClass1")

return sys::Err: Load from [null] package.MyClass1

Both classes exist, what's wrong?

shturman Thu 23 Apr 2015

SlimerDude, error happens only in afBedSheet apps, seems it's afPlastic bug. I explore this...

shturman Thu 23 Apr 2015

brian Thu 23 Apr 2015

They are both public classes in the same package?

In the end its gets routed to BootEnv.loadJavaType which does a classLoader.loadClass using normal Java relfection

shturman Thu 23 Apr 2015

Yes, public classes in the same package. I check visibility by:

echo(MyClass().typeof) //return [java]package::MyClass

echo(MyClass1().typeof) //return [java]package::MyClass1

but:

echo(Type.find("[java]package::MyClass")) //return [java]package::MyClass

echo(Type.find("[java]package::MyClass1")) //return error

Error only then this code inside afPillow page!

SlimerDude Thu 23 Apr 2015

Pillow pages are Types created on the fly by Plastic using Env.compileScript() - it does nothing special there.

Maybe there is something weird about the classloader from dynamically compiled scripts?

shturman Thu 23 Apr 2015

Seems it's something about caching classes - if i put echo(MyClass1().typeof) before echo(Type.find("[java]package::MyClass1")) error does not occur. What is the way to control caching and preload classes?

shturman Thu 23 Apr 2015

Finally i walk around and load classes directly in java

classLoader.loadClass("package::MyClass1").newInstance()

SlimerDude Fri 24 Apr 2015

Phew! I'm glad you found a work-around for I think I'd struggle to find the cause and a real fix!

Login or Signup to reply.