(List<ResourceInfo> incompleteResInfos,
List<String> allJars)
| 523 | } |
| 524 | |
| 525 | protected void fillInResInfos(List<ResourceInfo> incompleteResInfos, |
| 526 | List<String> allJars) throws IOException { |
| 527 | // now create a temporary class loader with all the JARs (scanned or |
| 528 | // not), so we can look up all the referenced classes in the normal |
| 529 | // way and read their CreoleResource annotations (if any). |
| 530 | URL[] jarUrls = new URL[allJars.size()]; |
| 531 | for(int i = 0; i < jarUrls.length; i++) { |
| 532 | jarUrls[i] = new URL(getBaseURL(), allJars.get(i)); |
| 533 | } |
| 534 | |
| 535 | // TODO shouldn't we use a proper temp gate class loader which we |
| 536 | // can then throw away? |
| 537 | try (URLClassLoader tempClassLoader = |
| 538 | new URLClassLoader(jarUrls, Gate.class.getClassLoader());) { |
| 539 | for(ResourceInfo ri : incompleteResInfos) { |
| 540 | String classFile = |
| 541 | ri.getResourceClassName().replace('.', '/') + ".class"; |
| 542 | InputStream classStream = |
| 543 | tempClassLoader.getResourceAsStream(classFile); |
| 544 | if(classStream != null) { |
| 545 | ClassReader classReader = new ClassReader(classStream); |
| 546 | ClassVisitor visitor = new ResourceInfoVisitor(ri); |
| 547 | classReader.accept(visitor, ClassReader.SKIP_CODE |
| 548 | | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); |
| 549 | classStream.close(); |
| 550 | } |
| 551 | } |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | public static class Directory extends Plugin { |
| 556 |
no test coverage detected