RFR: JDK-8179531: JShell: fails to provide bytecode for dynamically created lambdas

Jan Lahoda jan.lahoda at oracle.com
Thu May 4 21:07:32 UTC 2017


Thanks for the comments. An updated webrev:
http://cr.openjdk.java.net/~jlahoda/8179531/webrev.01/

On 4.5.2017 19:32, Paul Sandoz wrote:
>
>> On 4 May 2017, at 06:44, Jan Lahoda <jan.lahoda at oracle.com> wrote:
>>
>> Hi,
>>
>> This makes ClassLoader.getResource(s) return the actual bytecode that is being run.
>>
>> Bug:
>> https://bugs.openjdk.java.net/browse/JDK-8179531
>>
>> Webrev:
>> http://cr.openjdk.java.net/~jlahoda/8179531/webrev.00/
>>
>
> Looks good. Minor comments.
>
>
> DefaultLoaderDelegate
>>
>    68         private final Map<String, ClassFile> classFiles = new TreeMap<>();
>
> HashMap?

Sorry, done.

>
>
>   187                 } catch (MalformedURLException ex) {
>   188                 }
>
>
> Rather than swallowing the exception you might wanna throw an InternalError. I don’t think there are any valid resource names that used in a raw manner would result in the creation of a malformed URL, but just in case… I am a little paranoid about this, so would create a URI instance from the component parts, and then pass the result of toString to the URL constructor, thereby ensuring correct escaping of the resource name as the URL path. Up to you.

Done.

>
>
> GetResourceTest
>>
>   118         Thread.sleep(1000); //ensure time change:
>
> The test might intermittently fail. Recommend you wrap in try/catch (InterruptedException e ) {}

Done. (Will wait for a second even in case of the exception, to prevent 
following failure.)

>
>
>   136     public void checkFieldAccess() throws InterruptedException {
>
>   152     public void checkGetResources() throws InterruptedException {
>
> I don’t see how those methods throw InterruptedException.

Done.

Jan

>
> Paul.
>


More information about the kulla-dev mailing list