bedatadriven / renjin-docs

Documentation for Renjin, the R interpreter for the JVM
7 stars 4 forks source link

No access to Java accessors during script evaluation #7

Closed hinerm closed 8 years ago

hinerm commented 8 years ago

The automatic Java Bean conveniences actually make scripting in renjin unintuitive at first (for a Java developer), and even make some operations impossible (as far as I can tell).

For example, running the script:

"import(java.util.HashMap)\n"
"ageMap <- HashMap$new()\n"
"print(ageMap$getClass())";

Causes: org.renjin.eval.EvalException: Instance of class java.util.HashMap has no member named 'getClass'

Which would be manageable, except if I try to avoid using the accessor:

"import(java.util.HashMap)\n"
"ageMap <- HashMap$new()\n"
"print(ageMap$class)";

I still get an EvalException, for "no member named class".

In other cases the automatic Bean parsing worked great. But given this, it seems like Renjin is over-aggressive in stripping away accessors.

Also, I suggest preserving both accessor and direct field members to the External_Ptrs - so code from Java will work regardless of which it was written to use.

hinerm commented 8 years ago

Sorry - wrong repo. Moved to https://github.com/bedatadriven/renjin/issues/140