b73: IllegalAccessError: tried to access class java.util.stream.BaseStream

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Jan 16 14:46:51 PST 2013


On 16/01/13 19:21, Remi Forax wrote:
> On 01/16/2013 04:51 PM, Paul Sandoz wrote:
>> On Jan 16, 2013, at 4:17 PM, Dmitry Bessonov <dmitry.bessonov at oracle.com> wrote:
>>
>>> import java.util.Arrays;
>>> import java.util.stream.Stream;
>>>
>>> public class IllegalAccessErrorTest {
>>>
>>>       public static void main(String[] args) {
>>>
>>>           Stream stream = Arrays.asList("a", "b").stream();
>>>           System.err.println("iterator = " + stream.iterator());
>>>           Iterable iterable = stream::iterator;
>>>           System.err.println("iterable = " + iterable);
>>>       }
>>> }
>>>
>>> when compiled/run on b73 the output is:
>>>
>>>
>>> iterator = java.util.stream.ReferencePipeline$6 at 3256a5
>>> Exception in thread "main" java.lang.IllegalAccessError: tried to access
>>> class java.util.stream.BaseStream from class IllegalAccessErrorTest
>>>       at IllegalAccessErrorTest.main(IllegalAccessErrorTest.java:10)
>>>
>> Interesting. BaseStream was made package private.
>>
>> Looks like a bug in the runtime translation of the method reference.
> No, it's compiler bug, if you use javap -verbose you can see that the
> class file uses BaseStream::Iterator instead of Stream::iterator as
> argument of the bootstrap method.
Uhm - right, but the referenced method is in fact BaseStream::iterator 
since Stream does not override it...

Maurizio
>> Paul.
> Rémi
>
>>
>>> with b72 no exceptions are seen
>>>
>>> -Dmitry
>>>
>>>
>



More information about the lambda-dev mailing list