Commit 8e9ded0
authored
Fixes IllegalAccessError with Java package protected class (#21362)
This is a backport of Scala 2.x scala/scala#6023 by @lrytz
Fixes #13841
Fixes #13897
## Problem
When compiling `builder.call1().call2()` where both are Java-defined
package-protected class through a public subsclass, Scala 3 does not
properly cast the receiver to the public class, and results in an
IllegalAccessError.
## Solution
This backports the casting fix from the Scala 2.x compiler.File tree
4 files changed
+64
-25
lines changed- compiler/src/dotty/tools/dotc/transform
- tests/run/java-package-protected
4 files changed
+64
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
764 | 765 | | |
765 | 766 | | |
766 | 767 | | |
767 | | - | |
| 768 | + | |
| 769 | + | |
768 | 770 | | |
769 | 771 | | |
770 | 772 | | |
| |||
773 | 775 | | |
774 | 776 | | |
775 | 777 | | |
776 | | - | |
| 778 | + | |
777 | 779 | | |
778 | | - | |
| 780 | + | |
779 | 781 | | |
780 | | - | |
| 782 | + | |
781 | 783 | | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
803 | 806 | | |
804 | 807 | | |
805 | 808 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments