Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scalac can't load class which refers a class not from classpath #5343

Closed
scabug opened this issue Dec 28, 2011 · 5 comments
Closed

scalac can't load class which refers a class not from classpath #5343

scabug opened this issue Dec 28, 2011 · 5 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Dec 28, 2011

So I use a library which is supposed to work on jdk6 and jdk7. In some places it uses nio2.
Javac is to use this library just fine, but scalac throws

error: error while loading TFile, Missing dependency 'class java.nio.file.Path', required by c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-file\7.4.3\truezip-file-7.4.3.jar(de/schlichtherle/truezip/file/TFile.class)

here is a transcript:

D:\>javac -cp c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-file\7.4.3\truezip-file-7.4.3.jar;c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-driver-file\7.4.3\truezip-driver-file-7.4.3.jar;c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-kernel\7.4.3\truezip-kernel-7.4.3.jar test.java
de\schlichtherle\truezip\file\TFile.class(de\schlichtherle\truezip\file:TFile.class): warning: Cannot find annotation method 'value()' in type 'edu.umd.cs.findbugs.annotations.DefaultAnnotation': class file for edu.umd.cs.findbugs.annotations.DefaultAnnotation not found
de\schlichtherle\truezip\file\TFile.class(de\schlichtherle\truezip\file:TFile.class): warning: Cannot find annotation method 'value()' in type 'edu.umd.cs.findbugs.annotations.SuppressWarnings': class file for edu.umd.cs.findbugs.annotations.SuppressWarnings not found
de\schlichtherle\truezip\fs\FsMountPoint.class(de\schlichtherle\truezip\fs:FsMountPoint.class): warning: Cannot find annotation method 'value()' in type 'edu.umd.cs.findbugs.annotations.DefaultAnnotation'
de\schlichtherle\truezip\fs\FsMountPoint.class(de\schlichtherle\truezip\fs:FsMountPoint.class): warning: Cannot find annotation method 'value()' in type 'edu.umd.cs.findbugs.annotations.SuppressWarnings'
de\schlichtherle\truezip\fs\FsPath.class(de\schlichtherle\truezip\fs:FsPath.class): warning: Cannot find annotation method 'value()' in type 'edu.umd.cs.findbugs.annotations.DefaultAnnotation'
de\schlichtherle\truezip\fs\FsPath.class(de\schlichtherle\truezip\fs:FsPath.class): warning: Cannot find annotation method 'value()' in type 'edu.umd.cs.findbugs.annotations.SuppressWarnings'
6 warnings

D:\>java -cp c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-file\7.4.3\truezip-file-7.4.3.jar;c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-driver-file\7.4.3\truezip-driver-file-7.4.3.jar;c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-kernel\7.4.3\truezip-kernel-7.4.3.jar;.
test
D:\

D:\>scalac -cp c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-file\7.4.3\truezip-file-7.4.3.jar;c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-driver-file\7.4.3\truezip-driver-file-7.4.3.jar;c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-kernel\7.4.3\truezip-kernel-7.4.3.jar
test.scala
error: error while loading TFile, Missing dependency 'class java.nio.file.Path', required by c:\Users\OlegYch\.m2\repository\de\schlichtherle\truezip\truezip-file\7.4.3\truezip-file-7.4.3.jar(de/schlichtherle/truezip/file/TFile.class)
one error found

D:\>java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode)

D:\>scala -version
Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL

here is test.scala

object Main extends App {
  System.out.println(new de.schlichtherle.truezip.file.TFile("").getAbsoluteFile());
}

here is test.java

public class test {
  public static void main(String[] args) {
    System.out.println(new de.schlichtherle.truezip.file.TFile("").getAbsoluteFile());
  }
}

here is path to dependency packed as one jar
http://repo1.maven.org/maven2/de/schlichtherle/truezip/truezip-samples/7.4.3/truezip-samples-7.4.3-jar-with-dependencies.jar

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Dec 28, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5343?orig=1
Reporter: @OlegYch
Affected Versions: 2.9.1

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Dec 28, 2011

Pedro Furlanetto (pedrofurla) said (edited on Dec 28, 2011 6:08:29 PM UTC):
A sequence of bash commands creating and running a small test case.

echo "public class A { public B b; }" > A.java
echo "public class B { public C c; }" > B.java
echo "public class C { }" > C.java
echo class A_scala { var b:B = _ }  > A.scala # only to avoid name .class file name confusion
javac *.java
scalac A.scala

Every thing works fine so far.

rm C.class
rm A.class

Now comes the interesting part:

javac A.java
ls

As you can see, Java compiles just fine.

scalac A.scala

This will cause

{panel}
error: error while loading B, Missing dependency 'class C', required by ./B.class
one error found
{panel}

Scalac seems to be trying to load dependencies of B, despite B being already compiled.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Dec 28, 2011

Pedro Furlanetto (pedrofurla) said:
BTW, it's related to #3506, which never got a self contained test case.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 8, 2012

@paulp said:
1684baefd2

@scabug scabug closed this Jan 8, 2012
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 9, 2012

@OlegYch said:
thanks, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.