TrueZIP
  1. TrueZIP
  2. TRUEZIP-170

Scala & Groovy code does not compile on JSE 6

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: TrueZIP 7.3.4
    • Fix Version/s: None
    • Component/s: TrueZIP File*
    • Labels:
      None
    • Environment:

      all
      jdk 1.6.0_22

      Description

      TruezipTest.Scala

      class ScalaTree extends Application {

      override protected def work(args: Array[String]): Int =

      { val listfiles = if (0 >= args.length) List(".") else args.toList listfiles.foreach(listfile => new TFile(listfile)) return 0 }

      }
      compile result:

      error: error while loading TFile, Missing dependency 'class java.nio.file.Path', required by E:\m3repos\de\schlichtherle\truezip\truezip-file\7.3.2\truezip-file-7.3.2.jar(de/schlichtherle/truezip/file/TFile.class)

        Activity

        Hide
        Christian Schlichtherle added a comment - - edited

        I am just learning scala myself and I want to gradually introduce it in TrueZIP, so I am very disappointed to discover this issue. There are several components to it:

        (1) Unfortunately, in JSE 7, java.io.File.toPath() was added which returns a java.nio.file.Path.
        (2) I need to override this method in de.schlichtherle.truezip.file.TFile in order to cut the cyclic dependency it creates like this:

        @Deprecated
        @Override
        public java.nio.file.Path toPath() {
            throw new UnsupportedOperationException("Use a Path constructor or method instead!");
        }
        

        (3) For some reason, the scala compiler seems to do eager class loading on dependencies, which causes the error when run with a JVM < JSE 7.

        The only workaround is to compile scala code with JSE 7, although at run time you would only need JSE 6. If you are building on Mac OS X, you would need a beta of JSE 7 to do this.

        All this is unfortunate, but I can't change (1) and I don't want to change (2) because it would create problems, so maybe you can turn to the scala community and make them change (3), please?

        Show
        Christian Schlichtherle added a comment - - edited I am just learning scala myself and I want to gradually introduce it in TrueZIP, so I am very disappointed to discover this issue. There are several components to it: (1) Unfortunately, in JSE 7, java.io.File.toPath() was added which returns a java.nio.file.Path. (2) I need to override this method in de.schlichtherle.truezip.file.TFile in order to cut the cyclic dependency it creates like this: @Deprecated @Override public java.nio.file.Path toPath() { throw new UnsupportedOperationException( "Use a Path constructor or method instead!" ); } (3) For some reason, the scala compiler seems to do eager class loading on dependencies, which causes the error when run with a JVM < JSE 7. The only workaround is to compile scala code with JSE 7, although at run time you would only need JSE 6. If you are building on Mac OS X, you would need a beta of JSE 7 to do this. All this is unfortunate, but I can't change (1) and I don't want to change (2) because it would create problems, so maybe you can turn to the scala community and make them change (3), please?
        Hide
        Christian Schlichtherle added a comment -

        Please let me know what your findings are because I need a fix, too.

        Show
        Christian Schlichtherle added a comment - Please let me know what your findings are because I need a fix, too.
        Hide
        jskovjyskebankdk added a comment -

        For what it is worth, I experience the same problem with Groovy.

        As a workaround, I think I'll try to make a Java class for wrapping TrueZip calls.

        Show
        jskovjyskebankdk added a comment - For what it is worth, I experience the same problem with Groovy. As a workaround, I think I'll try to make a Java class for wrapping TrueZip calls.
        Hide
        Christian Schlichtherle added a comment -

        Fixing this issue would require changing the Input/OutputSocket APIs. This in turn would affect the TrueZIP Kernel module and all driver modules.

        Show
        Christian Schlichtherle added a comment - Fixing this issue would require changing the Input/OutputSocket APIs. This in turn would affect the TrueZIP Kernel module and all driver modules.
        Hide
        Christian Schlichtherle added a comment -

        This issue should probably addressed at the source, so Scala & Groovy respectively, because there isn't much what I could do about it.

        For what it's worth, TrueZIP 8 will require JSE 7, so there's not much point in fixing this issue anyway.

        Show
        Christian Schlichtherle added a comment - This issue should probably addressed at the source, so Scala & Groovy respectively, because there isn't much what I could do about it. For what it's worth, TrueZIP 8 will require JSE 7, so there's not much point in fixing this issue anyway.
        Hide
        Hypher added a comment -

        I'm curious if anyone has come up with a workaround for this issue. TrueZip would be quite helpful in my project, but we're using Scala 2.9 and Java 6, and due to various reasons, won't be switching to Java 7 immediately. If there isn't a workaround, should we just use TrueZip 6 until we switch to Java 7? If that's the case, it would be nice if there was a note in the TrueZip docs about this limitation.

        Show
        Hypher added a comment - I'm curious if anyone has come up with a workaround for this issue. TrueZip would be quite helpful in my project, but we're using Scala 2.9 and Java 6, and due to various reasons, won't be switching to Java 7 immediately. If there isn't a workaround, should we just use TrueZip 6 until we switch to Java 7? If that's the case, it would be nice if there was a note in the TrueZip docs about this limitation.
        Hide
        Christian Schlichtherle added a comment -

        I'm sorry that this affects you, but I really can't fix this issue because it's with the Scala compiler, which seems to do eager class loading.

        Right now, I am happily using Scala 2.9.2 on JSE 7u9 on Mac OS X and everything works fine. Sure this issue will resolve itself as people are gradually adopting JSE 7.

        If you are beginning a new project, using TrueZIP 6 is not really an option because it's completely obsolete. TrueZIP 7 is the latest which can run on Java 6 (well, if you are not using it with Scala) and TrueVFS (the successor of TrueZIP) definitely requires Java 7.

        Show
        Christian Schlichtherle added a comment - I'm sorry that this affects you, but I really can't fix this issue because it's with the Scala compiler, which seems to do eager class loading. Right now, I am happily using Scala 2.9.2 on JSE 7u9 on Mac OS X and everything works fine. Sure this issue will resolve itself as people are gradually adopting JSE 7. If you are beginning a new project, using TrueZIP 6 is not really an option because it's completely obsolete. TrueZIP 7 is the latest which can run on Java 6 (well, if you are not using it with Scala) and TrueVFS (the successor of TrueZIP) definitely requires Java 7.

          People

          • Assignee:
            Christian Schlichtherle
            Reporter:
            pinghe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: