@Override public void finishTree(DetailAST rootAST) { // loop over all the imports to see if referenced. imports.stream() .filter(imprt -> isUnusedImport(imprt.getText())) .forEach(imprt -> log(imprt.getDetailAst(), MSG_KEY, imprt.getText())); }
@Override public void visitToken(DetailAST ast) { final DetailAST nameAST = ast.getLastChild().getPreviousSibling(); final FullIdent full = FullIdent.createFullIdent(nameAST); if (!format.matcher(full.getText()).find()) { log(full.getDetailAst(), MSG_KEY, full.getText(), format.pattern()); } }
/** * Checks the identifier of the given type. * @param type node to check. */ private void checkIdent(DetailAST type) { final FullIdent ident = FullIdent.createFullIdent(type); if (isMatchingClassName(ident.getText())) { log(ident.getDetailAst(), MSG_KEY, ident.getText()); } }
@Test public void testGetDetailAst() throws Exception { final FileText testFileText = new FileText( new File(getPath("InputFullIdentTestArrayType.java")).getAbsoluteFile(), System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); final DetailAST packageDefinitionNode = JavaParser.parse(new FileContents(testFileText)); final DetailAST packageName = packageDefinitionNode.getFirstChild().getNextSibling(); final FullIdent ident = FullIdent.createFullIdent(packageName); Assert.assertEquals("Invalid full indent", "com[1x8]", ident.getDetailAst().toString()); }
@Override public void finishTree(DetailAST rootAST) { // loop over all the imports to see if referenced. imports.stream() .filter(imprt -> isUnusedImport(imprt.getText())) .forEach(imprt -> log(imprt.getDetailAst(), MSG_KEY, imprt.getText())); }
@Override public void visitToken(DetailAST ast) { final DetailAST nameAST = ast.getLastChild().getPreviousSibling(); final FullIdent full = FullIdent.createFullIdent(nameAST); if (!format.matcher(full.getText()).find()) { log(full.getDetailAst(), MSG_KEY, full.getText(), format.pattern()); } }
/** * Checks the identifier of the given type. * @param type node to check. */ private void checkIdent(DetailAST type) { final FullIdent ident = FullIdent.createFullIdent(type); if (isMatchingClassName(ident.getText())) { log(ident.getDetailAst(), MSG_KEY, ident.getText()); } }