Replacement for JDK8 APIs

Stéphane Nicoll snicoll at pivotal.io
Sun Nov 27 09:16:54 UTC 2016


Hey,

Thanks for all the feedback so far. Any idea about the annotation processor
question? Is there a dedicated dev list for it maybe?

Thank you,
S.


On Thu, Nov 24, 2016 at 3:22 PM, Stéphane Nicoll <snicoll at pivotal.io> wrote:

> Hi,
>
> I am working on the Spring Boot project[1] and I am trying to make sure
> our codebase compiles with the current JDK9 build[2]. So far I've hit two
> major issues:
>
> We use "sun.misc.VMSupport" to retrieve the port being used by the Java
> remote debugging. You can find the actual code in RemoteDebugPortProvider[3]
>
> We have an annotation processor that inspects all classes annotated with
> @ConfigurationProperties and generates some meta-data about them. One
> important piece of this is to extract the default value assigned to fields.
> Consider the following example
>
> @ConfigurationProperties
> public class Foo {
>
>   private static final String DEFAULT_NAME = "name";
>
>   private String name = DEFAULT_NAME;
>
>   private Integer counter = 42;
>
>   private List<String> hosts = Collections.singletonList("localhost");
>
>
> }
>
> What we've build is a visitor that navigates to those elements and
> extracts the default values assigned to each field, including navigating to
> parent element (the "name" constant there) or inferring value from method
> parameters ("localhost"). The  current code relies on a feature of the JDK
> that is no longer exported[4]:
>
>
> java.lang.IllegalAccessException: class org.springframework.boot.
> configurationprocessor.fieldvalues.javac.Trees cannot access class
> com.sun.tools.javac.api.JavacTrees (in module jdk.compiler) because
> module jdk.compiler does not export com.sun.tools.javac.api to unnamed
> module @5a7fe64
> <https://github.com/spring-projects/spring-boot/commit/5a7fe64f>
>
> Does anybody has some insight as how we could migrate those two use cases?
> In particular, the second use case could be implemented with a contract of
> javax.lang.model but we haven't found how to do it.
>
> Thank you,
> S.
>
>
>
> [1] https://github.com/spring-projects/spring-boot
> [2] https://github.com/spring-projects/spring-boot/issues/7226
> [3] https://github.com/spring-projects/spring-boot/blob/
> master/spring-boot-devtools/src/main/java/org/
> springframework/boot/devtools/tunnel/server/RemoteDebugPortProvider.java
> [4] https://github.com/spring-projects/spring-boot/blob/
> master/spring-boot-tools/spring-boot-configuration-
> processor/src/main/java/org/springframework/boot/configurationprocessor/
> fieldvalues/javac/Trees.java
>
>
>
>
>


More information about the jigsaw-dev mailing list