JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6799

Reopening Java class fails if set with ScriptingContainer#put and Java class

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.7.0.pre1
    • Fix Version/s: None
    • Component/s: Embedding
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      This is relevant for Ruboto.

      I would expect the following code to succeed. Especially since it succeeds if the commented section is uncommented.

      import org.jruby.embed.ScriptingContainer;
      
      class ReassignClassConstant {
          public static void main(String[] args) {
              ScriptingContainer sc = new ScriptingContainer();
              ReassignClassConstant i = new ReassignClassConstant();
      
              // sc.put("MyClass", sc.runScriptlet("Java::ReassignClassConstant"));
              // System.out.println(sc.get("MyClass"));
              // sc.runScriptlet("class MyClass\ndef first_method\nputs 'first method'\nend\nend");
              // sc.runRubyMethod(Object.class, i, "first_method");
      
              sc.put("MyClass", ReassignClassConstant.class);
              System.out.println(sc.get("MyClass"));
              sc.runScriptlet("class MyClass\ndef second_method\nputs 'second method'\nend\nend");
              sc.runRubyMethod(null, i, "second_method");
          }
      }
      

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Is there still a bug here?

        Show
        Charles Oliver Nutter added a comment - Is there still a bug here?
        Hide
        Uwe Kubosch added a comment -

        Sorry for the late answer. Yes, the given example still does not work, and I expect it to. I am especially interested in why the commented part should make a difference.

        Show
        Uwe Kubosch added a comment - Sorry for the late answer. Yes, the given example still does not work, and I expect it to. I am especially interested in why the commented part should make a difference.

          People

          • Assignee:
            Unassigned
            Reporter:
            Uwe Kubosch
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: