Integrated: 8325362: Allow to create a simple in-memory input JavaFileObject

Jan Lahoda jlahoda at openjdk.org
Tue Mar 19 09:38:26 UTC 2024


On Thu, 7 Mar 2024 08:34:32 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> There are many subtypes of `SimpleJavaFileObject` scattered through various codebases, majority of them looking like:
> 
> 
>     private static class JavaSource extends SimpleJavaFileObject {
> 
>         private String code;
> 
>         public JavaSource(String code) {
>             super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
>             this.code = code;
>         }
> 
>         @Override
>         public CharSequence getCharContent(boolean ignoreEncodingErrors) {
>             return code;
>         }
>     }
> 
> 
> The proposal herein is a to add a factory method that would return an implementation of `SimpleJavaFileObject` based on the provided `URI` and source content.
> 
> The CSR for this change is available for review here:
> https://bugs.openjdk.org/browse/JDK-8327536

This pull request has now been integrated.

Changeset: 5b6b5144
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/5b6b514441fcbbaa210e2cad08ce2704fdf38191
Stats:     379 lines in 23 files changed: 183 ins; 111 del; 85 mod

8325362: Allow to create a simple in-memory input JavaFileObject

Reviewed-by: jlaskey, darcy

-------------

PR: https://git.openjdk.org/jdk/pull/18149


More information about the compiler-dev mailing list