Java typeOf problem with Reflection

Hi

In the previous version typeOf always returned java &Class type so I could use :

  `var cp : String := java.net.URLDecoder.decode( typeOf(Program).getProtectionDomain().getCodeSource().getLocation().getPath(),'UTF-8');`

In the last release, I get compiler errors :
No member "getProtectionDomain" on type "remobjects.elements.rtl.reflection.Type"

Looks like using remobjects.elements.rtl namespaces changes typeOf behavior. If I remove
remobjects.elements.rtl.Reflection from uses section, the compiler doesn’t complain anymore.
Is it a bug and how to fix it if I would like to use Reflection namespace?

Correct. Similar to String, Elements RTL now also uses its own cross-ptlatform Type type by default, for improved cross-platform compatibility, only when its Reflection namespace is in scope. This is an as-desgned changed.

The solution os to either not use RemObjects.Elements.RTL.Reflection, (if you wanna work with Java’s own reflection APIs), or cast the Type to java.lang.Class where needed, of you do wanna use Elements RTLs Reflection for most stuff, Burt have to fall back to calling a Java-specific API.

1 Like