equal
deleted
inserted
replaced
36 import com.sun.tools.classfile.Dependency; |
36 import com.sun.tools.classfile.Dependency; |
37 import com.sun.tools.classfile.Dependency.Location; |
37 import com.sun.tools.classfile.Dependency.Location; |
38 |
38 |
39 import java.io.IOException; |
39 import java.io.IOException; |
40 import java.io.UncheckedIOException; |
40 import java.io.UncheckedIOException; |
|
41 import java.nio.file.Paths; |
41 import java.util.Collections; |
42 import java.util.Collections; |
42 import java.util.Deque; |
43 import java.util.Deque; |
43 import java.util.HashMap; |
44 import java.util.HashMap; |
44 import java.util.HashSet; |
45 import java.util.HashSet; |
45 import java.util.Map; |
46 import java.util.Map; |
170 if (parsedArchives.get(finder).contains(archive)) |
171 if (parsedArchives.get(finder).contains(archive)) |
171 return Optional.empty(); |
172 return Optional.empty(); |
172 |
173 |
173 parsedArchives.get(finder).add(archive); |
174 parsedArchives.get(finder).add(archive); |
174 |
175 |
175 trace("parsing %s %s%n", archive.getName(), archive.path()); |
176 trace("parsing %s %s%n", archive.getName(), archive.getPathName()); |
176 FutureTask<Set<Location>> task = new FutureTask<>(() -> { |
177 FutureTask<Set<Location>> task = new FutureTask<>(() -> { |
177 Set<Location> targets = new HashSet<>(); |
178 Set<Location> targets = new HashSet<>(); |
178 for (ClassFile cf : archive.reader().getClassFiles()) { |
179 for (ClassFile cf : archive.reader().getClassFiles()) { |
179 if (cf.access_flags.is(AccessFlags.ACC_MODULE)) |
180 if (cf.access_flags.is(AccessFlags.ACC_MODULE)) |
180 continue; |
181 continue; |
204 archive.addClass(d.getOrigin()); |
205 archive.addClass(d.getOrigin()); |
205 } |
206 } |
206 parsedClasses.putIfAbsent(d.getOrigin(), archive); |
207 parsedClasses.putIfAbsent(d.getOrigin(), archive); |
207 } |
208 } |
208 } |
209 } |
209 |
|
210 return targets; |
210 return targets; |
211 }); |
211 }); |
212 tasks.add(task); |
212 tasks.add(task); |
213 pool.submit(task); |
213 pool.submit(task); |
214 return Optional.of(task); |
214 return Optional.of(task); |
262 try { |
262 try { |
263 Set<Location> targets = new HashSet<>(); |
263 Set<Location> targets = new HashSet<>(); |
264 FutureTask<Set<Location>> task; |
264 FutureTask<Set<Location>> task; |
265 while ((task = tasks.poll()) != null) { |
265 while ((task = tasks.poll()) != null) { |
266 // wait for completion |
266 // wait for completion |
267 if (!task.isDone()) |
267 targets.addAll(task.get()); |
268 targets.addAll(task.get()); |
|
269 } |
268 } |
270 return targets; |
269 return targets; |
271 } catch (InterruptedException|ExecutionException e) { |
270 } catch (InterruptedException|ExecutionException e) { |
272 throw new Error(e); |
271 throw new Error(e); |
273 } |
272 } |