equal
deleted
inserted
replaced
39 import java.io.Writer; |
39 import java.io.Writer; |
40 import java.lang.reflect.Field; |
40 import java.lang.reflect.Field; |
41 import java.nio.file.Files; |
41 import java.nio.file.Files; |
42 import java.nio.file.Path; |
42 import java.nio.file.Path; |
43 import java.nio.file.Paths; |
43 import java.nio.file.Paths; |
44 import java.util.ArrayList; |
|
45 import java.util.Arrays; |
44 import java.util.Arrays; |
46 import java.util.Collection; |
|
47 import java.util.Collections; |
45 import java.util.Collections; |
48 import java.util.List; |
46 import java.util.List; |
49 import java.util.Map; |
47 import java.util.Map; |
50 import java.util.Set; |
48 import java.util.Set; |
51 |
49 |
55 import javax.annotation.processing.SupportedAnnotationTypes; |
53 import javax.annotation.processing.SupportedAnnotationTypes; |
56 import javax.annotation.processing.SupportedOptions; |
54 import javax.annotation.processing.SupportedOptions; |
57 import javax.lang.model.SourceVersion; |
55 import javax.lang.model.SourceVersion; |
58 import javax.lang.model.element.TypeElement; |
56 import javax.lang.model.element.TypeElement; |
59 import javax.tools.JavaCompiler; |
57 import javax.tools.JavaCompiler; |
|
58 import javax.tools.JavaFileManager; |
60 import javax.tools.StandardJavaFileManager; |
59 import javax.tools.StandardJavaFileManager; |
61 import javax.tools.StandardLocation; |
|
62 import javax.tools.ToolProvider; |
60 import javax.tools.ToolProvider; |
63 |
61 |
64 // import com.sun.source.util.JavacTask; |
62 // import com.sun.source.util.JavacTask; |
65 import com.sun.source.util.Plugin; |
63 import com.sun.source.util.Plugin; |
66 import com.sun.tools.javac.platform.PlatformDescription; |
64 import com.sun.tools.javac.platform.PlatformDescription; |
109 List<String> expectedOutput = |
107 List<String> expectedOutput = |
110 Arrays.asList("getSupportedPlatformNames", |
108 Arrays.asList("getSupportedPlatformNames", |
111 "getPlatform(name, " + expectedParameter + ")", |
109 "getPlatform(name, " + expectedParameter + ")", |
112 "getSourceVersion", |
110 "getSourceVersion", |
113 "getTargetVersion", |
111 "getTargetVersion", |
114 "getPlatformPath", |
112 "getFileManager", |
115 "testPlugin: [testPluginKey=testPluginValue]", |
113 "testPlugin: [testPluginKey=testPluginValue]", |
116 "process: {testAPKey=testAPValue}", |
114 "process: {testAPKey=testAPValue}", |
117 "process: {testAPKey=testAPValue}", |
115 "process: {testAPKey=testAPValue}", |
118 "PlatformProviderTestSource.java:4:49: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>", |
116 "PlatformProviderTestSource.java:4:49: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>", |
119 "compiler.misc.count.warn", |
117 "compiler.misc.count.warn", |
185 class DescriptionImpl implements PlatformDescription { |
183 class DescriptionImpl implements PlatformDescription { |
186 |
184 |
187 private final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
185 private final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
188 private final StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null); |
186 private final StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null); |
189 |
187 |
190 |
188 @Override |
191 @Override |
189 public JavaFileManager getFileManager() { |
192 public Collection<Path> getPlatformPath() { |
190 System.err.println("getFileManager"); |
193 System.err.println("getPlatformPath"); |
191 return fm; |
194 List<Path> result = new ArrayList<>(); |
|
195 fm.getLocationAsPaths(StandardLocation.PLATFORM_CLASS_PATH).forEach(p -> { result.add(p); }); |
|
196 return result; |
|
197 } |
192 } |
198 |
193 |
199 @Override |
194 @Override |
200 public String getSourceVersion() { |
195 public String getSourceVersion() { |
201 System.err.println("getSourceVersion"); |
196 System.err.println("getSourceVersion"); |