Class.forName editor bug

I'm instantiating an instance of a Class based on what's in a properties file, like this:

display = (Display)Class.forName( Client.mainProps.getProperty( "display.class" ) ).newInstance();

The editor is marking this line red, with the error message:

Inconvertible types; cannot cast '?' to 'mypackage.Display'

But it compiles and runs ok, just annoying. Why is the editor complaining?

Darrel

2 comments
Comment actions Permalink

Idea 4.5.4 on windows, build 2253

0
Comment actions Permalink

It's a bug. Fixed in upcoming 5.0

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

I'm instantiating an instance of a Class based on what's in a
properties file, like this:

display = (Display)Class.forName( Client.mainProps.getProperty(
"display.class" ) ).newInstance();

The editor is marking this line red, with the error message:

Inconvertible types; cannot cast '?' to 'mypackage.Display'

But it compiles and runs ok, just annoying. Why is the editor
complaining?

Darrel



0

Please sign in to leave a comment.