Re: scalac compilation requires transitive dependencies on classpath at compile-time whereas javac does not

Jason Zaugg <[email protected]> Wed, 24 Feb 2016 00:18:59 +0000
Newsgroups gmane.comp.lang.scala
Message-ID <CAG3_yeUy2ZVdbkSs_sOP3CxRaR4chbxpY3BU5YSS1pJsFdNMAw@mail.gmail.com>
What Scala version(s) are you testing with? Robustness to missing
dependencies fluctuated somewhat through 2.10 and 2.11 releases.

Could you boil this down to a test case like this one? I’ll then be better
able to answer your questions.

% cat sandbox/test.scala
class A

class B {
  def foo(a: A) = a
  def bar = 42
}

% (export V=2.11.7; ~/scala/$V/bin/scalac sandbox/test.scala; rm
A.class; ~/scala/$V/bin/scala -nc -e 'new B().bar')

% (export V=2.11.7; ~/scala/$V/bin/scalac sandbox/test.scala; rm
A.class; ~/scala/$V/bin/scala -nc -e 'new B().foo(null)')
error: missing or invalid dependency detected while loading class file
'B.class'.
Could not access type A in package <empty>,
because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to
see the problematic classpath.)
A full rebuild may help if 'B.class' was compiled against an
incompatible version of <empty>.
/code/scala on topic/nuke-impl-classes-2*

As you can see from my test, the intention is to create a stub symbol for
the type of the parameter a when we read the B.class, and defer any error
until typechecking can’t proceed without knowing more about that type.

Regards,

-jason
​

-- 
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.