RFR: 8149843, 8150111 Two small changes to StandardJavaFileManager API

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu May 12 18:26:51 UTC 2016


After merging with the latest jdk9/dev bits, some additional minor 
changes are required in jdk.jshell, to avoid the use of Iterable<? 
extends Path>. The most obvious change is simply to use List<Path> 
instead, as shown here.

$ hg diff src/jdk.jshell
diff -r c51b40933e0c 
src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java
--- 
a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java 
Wed May 11 20:28:22 2016 +0000
+++ 
b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java 
Thu May 12 11:25:46 2016 -0700
@@ -1045,7 +1045,7 @@

          public SourceCache(AnalyzeTask originalTask) {
              this.originalTask = originalTask;
-            Iterable<? extends Path> sources = findSources();
+            List<Path> sources = findSources();
              if (sources.iterator().hasNext()) {
                  StandardJavaFileManager fm = 
compiler.getStandardFileManager(null, null, null);
                  try {
@@ -1145,9 +1145,9 @@
          }
      }

-    private Iterable<? extends Path> availableSources;
+    private List<Path> availableSources;

-    private Iterable<? extends Path> findSources() {
+    private List<Path> findSources() {
          if (availableSources != null) {
              return availableSources;
          }



On 05/12/2016 08:21 AM, Jan Lahoda wrote:
> Looks fine to me too.
>
> Jan
>
> On 12.5.2016 00:27, Vicente-Arturo Romero-Zaldivar wrote:
>> approved,
>>
>> Thanks,
>> Vicente
>>
>> On 05/06/2016 07:22 PM, Jonathan Gibbons wrote:
>>> This is for two small changes to the StandardJavaFileManager API.
>>>
>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8149843
>>> StandardJavaFileManager should provide a way to get paths from strings
>>>
>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8150111
>>> Need to change signature of 
>>> StandardJavaFileManager.setLocationFromPaths
>>>
>>> With these changes, all standard uses of Paths.get are replaced by 
>>> using
>>> a user-provided function, defaulting to Paths::get.
>>>
>>> The exceptions are:
>>>     file names specified on the javac command line
>>>     file names used in some internal debugging/tracing features in 
>>> javac
>>>     file names used in sjavac
>>>
>>> Combined specdiff: http://cr.openjdk.java.net/~jjg/8149843/specdiff.00/
>>> Combined webrev: http://cr.openjdk.java.net/~jjg/8149843/webrev.00/
>>>
>>> -- Jon
>>



More information about the compiler-dev mailing list