@Test public void testDeDup() throws Exception { ConfigurationCheckReport report = checker.performConfigCheck(null); if(!report.isCheckPassed()) { assertTrue(report.getWarnings().size() > 0); } assertNotNull(report.toString()); }
@SuppressWarnings("resource") @Override public ConfigurationCheckReport performConfigCheck(ConfigurationCheckReport report, BootstrapProperties bootProperties) { boolean passed = true; try (ScanResult result = new ClassGraph().scan()) { for (Map.Entry<String, ResourceList> dup : result.getAllResources().classFilesOnly().findDuplicatePaths()) { if (dup.getKey().equalsIgnoreCase("module-info.class")) { continue; } passed = false; if (debugMode()) { System.err.println(String.format("%s has possible duplicates", dup.getKey())); for (Resource res : dup.getValue()) { System.err.println(String.format(" -> Found in %s", res.getURI())); } } } } if(!passed) { if (debugMode()) { report.getWarnings().add("Possible duplicates found. Details above."); } else { report.getWarnings().add("Possible duplicates found. Re-run with '-Dinterlok.bootstrap.debug=true' for more details."); } } return report; }
ClasspathDupConfigurationChecker implements ConfigurationChecker { @SuppressWarnings("resource") @Override public ConfigurationCheckReport performConfigCheck(ConfigurationCheckReport report, BootstrapProperties bootProperties) { boolean passed = true; try (ScanResult result = new ClassGraph().scan()) { for (Map.Entry<String, ResourceList> dup : result.getAllResources().classFilesOnly().findDuplicatePaths()) { if (dup.getKey().equalsIgnoreCase("module-info.class")) { continue; } passed = false; if (debugMode()) { System.err.println(String.format("%s has possible duplicates", dup.getKey())); for (Resource res : dup.getValue()) { System.err.println(String.format(" -> Found in %s", res.getURI())); } } } } if(!passed) { if (debugMode()) { report.getWarnings().add("Possible duplicates found. Details above."); } else { report.getWarnings().add("Possible duplicates found. Re-run with '-Dinterlok.bootstrap.debug=true' for more details."); } } return report; } }
ClasspathDupConfigurationChecker implements ConfigurationChecker { @SuppressWarnings("resource") @Override public ConfigurationCheckReport performConfigCheck(ConfigurationCheckReport report, BootstrapProperties bootProperties) { boolean passed = true; try (ScanResult result = new ClassGraph().scan()) { for (Map.Entry<String, ResourceList> dup : result.getAllResources().classFilesOnly().findDuplicatePaths()) { if (dup.getKey().equalsIgnoreCase("module-info.class")) { continue; } passed = false; if (debugMode()) { System.err.println(String.format("%s has possible duplicates", dup.getKey())); for (Resource res : dup.getValue()) { System.err.println(String.format(" -> Found in %s", res.getURI())); } } } } if(!passed) { if (debugMode()) { report.getWarnings().add("Possible duplicates found. Details above."); } else { report.getWarnings().add("Possible duplicates found. Re-run with '-Dinterlok.bootstrap.debug=true' for more details."); } } return report; }  }
ClasspathDupConfigurationChecker implements ConfigurationChecker { @SuppressWarnings("resource") @Override public ConfigurationCheckReport performConfigCheck(ConfigurationCheckReport report, BootstrapProperties bootProperties) { boolean passed = true; try (ScanResult result = new ClassGraph().scan()) { for (Map.Entry<String, ResourceList> dup : result.getAllResources().classFilesOnly().findDuplicatePaths()) { if (dup.getKey().equalsIgnoreCase("module-info.class")) { continue; } passed = false; if (debugMode()) { System.err.println(String.format("%s has possible duplicates", dup.getKey())); for (Resource res : dup.getValue()) { System.err.println(String.format(" -> Found in %s", res.getURI())); } } } } if(!passed) { if (debugMode()) { report.getWarnings().add("Possible duplicates found. Details above."); } else { report.getWarnings().add("Possible duplicates found. Re-run with '-Dinterlok.bootstrap.debug=true' for more details."); } } return report; }  @SuppressWarnings("resource") @Override ConfigurationCheckReport performConfigCheck(ConfigurationCheckReport report, BootstrapProperties bootProperties); @Override String getFriendlyName(); boolean isDebug(); void setDebug(boolean debug); }
ClasspathDupConfigurationChecker implements ConfigurationChecker { @SuppressWarnings("resource") @Override public ConfigurationCheckReport performConfigCheck(ConfigurationCheckReport report, BootstrapProperties bootProperties) { boolean passed = true; try (ScanResult result = new ClassGraph().scan()) { for (Map.Entry<String, ResourceList> dup : result.getAllResources().classFilesOnly().findDuplicatePaths()) { if (dup.getKey().equalsIgnoreCase("module-info.class")) { continue; } passed = false; if (debugMode()) { System.err.println(String.format("%s has possible duplicates", dup.getKey())); for (Resource res : dup.getValue()) { System.err.println(String.format(" -> Found in %s", res.getURI())); } } } } if(!passed) { if (debugMode()) { report.getWarnings().add("Possible duplicates found. Details above."); } else { report.getWarnings().add("Possible duplicates found. Re-run with '-Dinterlok.bootstrap.debug=true' for more details."); } } return report; }  @SuppressWarnings("resource") @Override ConfigurationCheckReport performConfigCheck(ConfigurationCheckReport report, BootstrapProperties bootProperties); @Override String getFriendlyName(); boolean isDebug(); void setDebug(boolean debug);  }