Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Blocker Blocker
    • Resolution: Not A Bug
    • Affects Version/s: JRuby 1.7.0.pre2
    • Fix Version/s: JRuby 1.7.0.RC1
    • Component/s: Java Integration
    • Labels:
      None
    • Environment:
      ArchLinux x86_64 on AMD VMware Virtual Machine, 8 GB RAM. Oracle Java-SE JDK-1.7.0_05
    • Number of attachments :
      0

      Description

      This problem is preventing us from continuing further testing and dev using 1.7.0pre2 binary release. Falling back to 1.7.0pre1, this issue does not persist.

      Java class import no longer working as expected. Definite broken compatability from JRuby-1.7.0-pre1 and previous releases of 1.5 and 1.6 where this functionality worked flawlessly. To reproduce, our program is using a Java terminal library called 'JLine' (http://jline.sourceforge.net/).

      The ruby code to reproduce the JRuby error is:

      — snip —

      1. Imports JLine Jar for ANSI Console Functions
        require 'class/jline-1.0.jar'
        module JLine
        include_package "jline"
        end

      JLine::ConsoleReader.new.clearScreen

      — /snip —

      The expected result is to clear a linux terminal screen. In pre2, Jruby spews the following error:

      [ctusa@archbox]$ jruby ./clearscreen.rb
      Security file exist, not generating.
      ConsoleReader.java:174:in `<init>': java.lang.IncompatibleClassChangeError: Found interface jline.Terminal, but class was expected
      from ConsoleReader.java:169:in `<init>'
      from ConsoleReader.java:157:in `<init>'
      from NativeConstructorAccessorImpl.java:-2:in `newInstance0'
      from NativeConstructorAccessorImpl.java:57:in `newInstance'
      from DelegatingConstructorAccessorImpl.java:45:in `newInstance'
      from Constructor.java:525:in `newInstance'
      from JavaConstructor.java:259:in `newInstanceDirect'
      from ConstructorInvoker.java:79:in `call'
      from ConstructorInvoker.java:160:in `call'
      from CachingCallSite.java:302:in `cacheAndCall'
      from CachingCallSite.java:144:in `callBlock'
      from CachingCallSite.java:148:in `call'
      from ConcreteJavaProxy.java:48:in `call'
      from CachingCallSite.java:302:in `cacheAndCall'
      from CachingCallSite.java:144:in `callBlock'
      from CachingCallSite.java:148:in `call'
      from RubyClass.java:856:in `newInstance'
      from RubyClass$INVOKER$i$newInstance.gen:-1:in `call'
      from JavaMethod.java:257:in `call'
      from ConcreteJavaProxy.java:141:in `call'
      from CachingCallSite.java:292:in `cacheAndCall'
      from CachingCallSite.java:135:in `call'
      from CallNoArgNode.java:63:in `interpret'
      from CallNoArgNode.java:63:in `interpret'
      from NewlineNode.java:104:in `interpret'
      from ASTInterpreter.java:75:in `INTERPRET_METHOD'
      from InterpretedMethod.java:139:in `call'
      from DefaultMethod.java:176:in `call'
      from CachingCallSite.java:292:in `cacheAndCall'
      from CachingCallSite.java:135:in `call'
      from CallNoArgNode.java:63:in `interpret'
      from NewlineNode.java:104:in `interpret'
      from BlockNode.java:71:in `interpret'
      from ASTInterpreter.java:75:in `INTERPRET_METHOD'
      from InterpretedMethod.java:182:in `call'
      from DefaultMethod.java:192:in `call'
      from CachingCallSite.java:312:in `cacheAndCall'
      from CachingCallSite.java:169:in `call'
      from ./clearscreen.rb:7:in `_file_'
      from ./clearscreen.rb:-1:in `load'
      from Ruby.java:780:in `runScript'
      from Ruby.java:773:in `runScript'
      from Ruby.java:650:in `runNormally'
      from Ruby.java:499:in `runFromMain'
      from Main.java:376:in `doRunFromMain'
      from Main.java:265:in `internalRun'
      from Main.java:231:in `run'
      from Main.java:215:in `run'
      from Main.java:195:in `main'

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        This is not actually a bug. JRuby pre2 ships a newer version of jline that has changed some classes into interfaces, reworked some APIs, etc.

        Is it possible for you to just use the jline2 we ship? An alternative for you would be to strip jline classes out of the jruby.jar file completely.

        Show
        Charles Oliver Nutter added a comment - This is not actually a bug. JRuby pre2 ships a newer version of jline that has changed some classes into interfaces, reworked some APIs, etc. Is it possible for you to just use the jline2 we ship? An alternative for you would be to strip jline classes out of the jruby.jar file completely.
        Hide
        Charles Oliver Nutter added a comment -

        Alternative code that just uses jline2 classes:

        Java::jline.console.ConsoleReader.new.clearScreen
        

        You can of course java_import 'jline.console.ConsoleReader' into your JLine namespace if you prefer.

        Show
        Charles Oliver Nutter added a comment - Alternative code that just uses jline2 classes: Java::jline.console.ConsoleReader.new.clearScreen You can of course java_import 'jline.console.ConsoleReader' into your JLine namespace if you prefer.
        Hide
        Chris Tusa added a comment -

        After refactoring the code to match the new namespace, this seems to work. Are the jline specific API calls included in the JRuby JavaDocs?

        Show
        Chris Tusa added a comment - After refactoring the code to match the new namespace, this seems to work. Are the jline specific API calls included in the JRuby JavaDocs?
        Hide
        Chris Tusa added a comment -

        Closing due to JLine2 integration into Jruby. Note that sourceforge version of jline-1.0 is not API compatible with jline2 on github.

        Show
        Chris Tusa added a comment - Closing due to JLine2 integration into Jruby. Note that sourceforge version of jline-1.0 is not API compatible with jline2 on github.
        Hide
        Charles Oliver Nutter added a comment -

        We do not document third-party libraries that are shipped with JRuby, but we do document that we ship them (via Maven, LICENSE docs, and so on). The API changes in jline2 are perhaps unfortunate, but we had to adjust to them like everyone else.

        Also perhaps interesting to note that we did originally attempt to mangle the jline packages into an internal name, but because they do reflective loading of some classes this broke other jline functionality.

        Show
        Charles Oliver Nutter added a comment - We do not document third-party libraries that are shipped with JRuby, but we do document that we ship them (via Maven, LICENSE docs, and so on). The API changes in jline2 are perhaps unfortunate, but we had to adjust to them like everyone else. Also perhaps interesting to note that we did originally attempt to mangle the jline packages into an internal name, but because they do reflective loading of some classes this broke other jline functionality.

          People

          • Assignee:
            Unassigned
            Reporter:
            Chris Tusa
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: