@Override public void visitNode(Tree tree) { NewClassTree newClassTree = (NewClassTree) tree; TypeTree newTypeTree = newClassTree.identifier(); if (newClassTree.classBody() == null && isParameterizedType(newTypeTree)) { TypeTree type = getTypeFromExpression(tree.parent()); if (type != null && isParameterizedType(type)) { reportIssue( ((ParameterizedTypeTree) newTypeTree).typeArguments(), "Replace the type specification in this constructor call with the diamond operator (\"<>\")." + JavaVersionHelper.java7CompatibilityMessage(context.getJavaVersion())); } } }
@Override public boolean isCompatibleWithJavaVersion(@Nullable Integer version) { return JavaVersionHelper.java7Compatible(version); }