Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.7.0.pre2
    • Fix Version/s: JRuby 1.7.0.RC1
    • Labels:
      None
    • Environment:
      Dalvik VM
    • Number of attachments :
      0

      Description

      So, I would like to get this working while not duplicating work.

      What has Lynne done?

      Where should I start looking? MethodFactory?

        Activity

        Hide
        Uwe Kubosch added a comment -

        OK, looks like the DexClassloader does not override defineClass.

        Trying with loadClass instead.

        Show
        Uwe Kubosch added a comment - OK, looks like the DexClassloader does not override defineClass. Trying with loadClass instead.
        Hide
        Uwe Kubosch added a comment -

        Feels like I am really close! I committed a change for JavaProxyClassFactory that converts the JVM byte code to Dalvik byte code, saves it to a JAR and tries to load it using the DexClassLoader. It fails with this error:

        D/dalvikvm(26052): DexOpt: --- BEGIN 'ArrayAdapter$Proxy0.jar' (bootstrap=0) ---
        W/dalvikvm(26071): Invalid file flags in class Lorg/jruby/proxy/android/widget/ArrayAdapter$Proxy0;: 0019
        F/libc    (26071): Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1)
        ...
        W/dalvikvm(26052): DexOpt: --- END 'ArrayAdapter$Proxy0.jar' --- status=0x000b, process failed
        E/dalvikvm(26052): Unable to extract+optimize DEX from '/data/data/org.ruboto.test_app/app_dex/org/jruby/proxy/android/widget/ArrayAdapter$Proxy0.jar'
        

        I have no idea what file flags 0019 mean. Any help is appreciated.

        Show
        Uwe Kubosch added a comment - Feels like I am really close! I committed a change for JavaProxyClassFactory that converts the JVM byte code to Dalvik byte code, saves it to a JAR and tries to load it using the DexClassLoader. It fails with this error: D/dalvikvm(26052): DexOpt: --- BEGIN 'ArrayAdapter$Proxy0.jar' (bootstrap=0) --- W/dalvikvm(26071): Invalid file flags in class Lorg/jruby/proxy/android/widget/ArrayAdapter$Proxy0;: 0019 F/libc (26071): Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1) ... W/dalvikvm(26052): DexOpt: --- END 'ArrayAdapter$Proxy0.jar' --- status=0x000b, process failed E/dalvikvm(26052): Unable to extract+optimize DEX from '/data/data/org.ruboto.test_app/app_dex/org/jruby/proxy/android/widget/ArrayAdapter$Proxy0.jar' I have no idea what file flags 0019 mean. Any help is appreciated.
        Hide
        Uwe Kubosch added a comment -

        Hi!

        I changed the example to load the byte array generated by the HelloWorldASM class given in https://github.com/sciruela/android , and the class loads successfully with the code checked in on the JRUBY-6883 branch.

        That leads me to think that the byte stream given by JRuby to load the class is missing something, but I have no idea what that would be.

        Any ideas? It would just be AWESOME if we could get this to work.

        Show
        Uwe Kubosch added a comment - Hi! I changed the example to load the byte array generated by the HelloWorldASM class given in https://github.com/sciruela/android , and the class loads successfully with the code checked in on the JRUBY-6883 branch. That leads me to think that the byte stream given by JRuby to load the class is missing something, but I have no idea what that would be. Any ideas? It would just be AWESOME if we could get this to work.
        Hide
        Uwe Kubosch added a comment -

        GOT IT WORKING! We can now subclass ArrayAdapter directly without any magic!

        The error is that JavaProxyClassFactory#beginProxyClass sets the ACC_STATIC flag which is invalid for a class file. Removing the flag fixed the problem.

        Concept proven!

        Show
        Uwe Kubosch added a comment - GOT IT WORKING! We can now subclass ArrayAdapter directly without any magic! The error is that JavaProxyClassFactory#beginProxyClass sets the ACC_STATIC flag which is invalid for a class file. Removing the flag fixed the problem. Concept proven!
        Hide
        Uwe Kubosch added a comment -

        Enebo added a system property to set a custom proxy class factory which we set from Ruboto. It works nicely, and has very little impact on JRuby core.

        Thanks!

        Show
        Uwe Kubosch added a comment - Enebo added a system property to set a custom proxy class factory which we set from Ruboto. It works nicely, and has very little impact on JRuby core. Thanks!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: