@Test public void testReferenceProcessor() throws Exception { final String[] args = { "-i", "src/test/resources/src/", "-o", "target/spooned/", }; final Launcher launcher = new Launcher(); launcher.setArgs(args); launcher.run(); final Factory factory = launcher.getFactory(); final ProcessingManager processingManager = new QueueProcessingManager(factory); final ReferenceProcessor processor = new ReferenceProcessor(); processingManager.addProcessor(processor); processingManager.process(factory.Package().getRootPackage()); assertThat(processor.circularPathes.size(), is(2)); }
public void process(CtPackage element) { CtPackageReference pack = element.getReference(); Set<CtPackageReference> refs = new HashSet<>(); for (CtType t : element.getTypes()) { List<CtTypeReference<?>> listReferences = Query.getReferences(t, new ReferenceTypeFilter<>(CtTypeReference.class)); for (CtTypeReference<?> tref : listReferences) { if (tref.getPackage() != null && !tref.getPackage().equals(pack)) { if (ignoredTypes.contains(tref)) continue; refs.add(tref.getPackage()); } } } if (!refs.isEmpty()) { packRefs.put(pack, refs); } }
ReferenceProcessor extends AbstractProcessor<CtPackage> { public void process(CtPackage element) { CtPackageReference pack = element.getReference(); Set<CtPackageReference> refs = new HashSet<>(); for (CtType t : element.getTypes()) { List<CtTypeReference<?>> listReferences = Query.getReferences(t, new ReferenceTypeFilter<>(CtTypeReference.class)); for (CtTypeReference<?> tref : listReferences) { if (tref.getPackage() != null && !tref.getPackage().equals(pack)) { if (ignoredTypes.contains(tref)) continue; refs.add(tref.getPackage()); } } } if (!refs.isEmpty()) { packRefs.put(pack, refs); } } }
ReferenceProcessor extends AbstractProcessor<CtPackage> { public void process(CtPackage element) { CtPackageReference pack = element.getReference(); Set<CtPackageReference> refs = new HashSet<>(); for (CtType t : element.getTypes()) { List<CtTypeReference<?>> listReferences = Query.getReferences(t, new ReferenceTypeFilter<>(CtTypeReference.class)); for (CtTypeReference<?> tref : listReferences) { if (tref.getPackage() != null && !tref.getPackage().equals(pack)) { if (ignoredTypes.contains(tref)) continue; refs.add(tref.getPackage()); } } } if (!refs.isEmpty()) { packRefs.put(pack, refs); } }  }
ReferenceProcessor extends AbstractProcessor<CtPackage> { public void process(CtPackage element) { CtPackageReference pack = element.getReference(); Set<CtPackageReference> refs = new HashSet<>(); for (CtType t : element.getTypes()) { List<CtTypeReference<?>> listReferences = Query.getReferences(t, new ReferenceTypeFilter<>(CtTypeReference.class)); for (CtTypeReference<?> tref : listReferences) { if (tref.getPackage() != null && !tref.getPackage().equals(pack)) { if (ignoredTypes.contains(tref)) continue; refs.add(tref.getPackage()); } } } if (!refs.isEmpty()) { packRefs.put(pack, refs); } }  @Override void init(); void process(CtPackage element); @Override void processingDone(); }
ReferenceProcessor extends AbstractProcessor<CtPackage> { public void process(CtPackage element) { CtPackageReference pack = element.getReference(); Set<CtPackageReference> refs = new HashSet<>(); for (CtType t : element.getTypes()) { List<CtTypeReference<?>> listReferences = Query.getReferences(t, new ReferenceTypeFilter<>(CtTypeReference.class)); for (CtTypeReference<?> tref : listReferences) { if (tref.getPackage() != null && !tref.getPackage().equals(pack)) { if (ignoredTypes.contains(tref)) continue; refs.add(tref.getPackage()); } } } if (!refs.isEmpty()) { packRefs.put(pack, refs); } }  @Override void init(); void process(CtPackage element); @Override void processingDone(); public List<List<CtPackageReference>> circularPathes; }