daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest May 21st, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## A.java
  2.  
  3. package x;
  4.  
  5. class A {
  6.   protected int q = 13;
  7. }
  8.  
  9. ## B.scala
  10.  
  11. package x;
  12.  
  13. class B {
  14.   val a = new A()
  15.   println(a.q)
  16. }
  17.  
  18. ## And then...
  19.  
  20. pstickne@test$ scalac *.java *.scala
  21. B.scala:5: error: variable q cannot be accessed in x.A
  22.   println(a.q)
  23.             ^
  24. one error found
  25.  
  26. ## ... but even when separate
  27.  
  28. pstickne@test$ javac -d . A.java
  29. pstickne@test$ scalac B.scala
  30. B.scala:5: error: variable q cannot be accessed in x.A
  31.   println(a.q)
  32.             ^
  33. one error found
  34.  
  35.  
  36.  
  37. <mapreduce> fwiw it looks like you should look at line 326 or so of scala/src/compiler/scala/tools/nsc/typechecker/Infer.scala
  38. <mapreduce> checkAccessible
  39. <mapreduce> Or report a bug :)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top