Skip to content
Permalink
Browse files
use diamond operator
  • Loading branch information
paulk-asert committed May 3, 2022
1 parent 937a5bf commit cf45a0d3dbe40a7c16a7f75c1d0bc4b43a2dc785
Showing 1 changed file with 20 additions and 20 deletions.
@@ -62,7 +62,7 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc imp
public static final Pattern NAME_ARGS_REGEX = Pattern.compile("([^(]+)\\(([^)]*)\\)");
public static final Pattern SPLIT_ARGS_REGEX = Pattern.compile(",\\s*");
private static final List<String> PRIMITIVES = Arrays.asList("void", "boolean", "byte", "short", "char", "int", "long", "float", "double");
private static final Map<String, String> TAG_TEXT = new LinkedHashMap<String, String>();
private static final Map<String, String> TAG_TEXT = new LinkedHashMap<>();
private static final GroovyConstructorDoc[] EMPTY_GROOVYCONSTRUCTORDOC_ARRAY = new GroovyConstructorDoc[0];
private static final GroovyClassDoc[] EMPTY_GROOVYCLASSDOC_ARRAY = new GroovyClassDoc[0];
private static final GroovyFieldDoc[] EMPTY_GROOVYFIELDDOC_ARRAY = new GroovyFieldDoc[0];
@@ -106,23 +106,23 @@ public SimpleGroovyClassDoc(List<String> importedClassesAndPackages, Map<String,
this.importedClassesAndPackages = importedClassesAndPackages;
this.aliases = aliases;
this.links = links;
constructors = new ArrayList<GroovyConstructorDoc>();
fields = new ArrayList<GroovyFieldDoc>();
properties = new ArrayList<GroovyFieldDoc>();
enumConstants = new ArrayList<GroovyFieldDoc>();
methods = new ArrayList<GroovyMethodDoc>();
interfaceNames = new ArrayList<String>();
interfaceClasses = new ArrayList<GroovyClassDoc>();
nested = new ArrayList<GroovyClassDoc>();
resolvedExternalClassesCache = new HashMap<String, Class<?>>();
constructors = new ArrayList<>();
fields = new ArrayList<>();
properties = new ArrayList<>();
enumConstants = new ArrayList<>();
methods = new ArrayList<>();
interfaceNames = new ArrayList<>();
interfaceClasses = new ArrayList<>();
nested = new ArrayList<>();
resolvedExternalClassesCache = new HashMap<>();
}

public SimpleGroovyClassDoc(List<String> importedClassesAndPackages, Map<String, String> aliases, String name) {
this(importedClassesAndPackages, aliases, name, new ArrayList<LinkArgument>());
this(importedClassesAndPackages, aliases, name, new ArrayList<>());
}

public SimpleGroovyClassDoc(List<String> importedClassesAndPackages, String name) {
this(importedClassesAndPackages, new LinkedHashMap<String, String>(), name, new ArrayList<LinkArgument>());
this(importedClassesAndPackages, new LinkedHashMap<>(), name, new ArrayList<>());
}

/**
@@ -262,7 +262,7 @@ public String getRelativeRootPath() {

// TODO move logic here into resolve
public List<GroovyClassDoc> getParentClasses() {
List<GroovyClassDoc> result = new LinkedList<GroovyClassDoc>();
List<GroovyClassDoc> result = new LinkedList<>();
if (isInterface()) return result;
result.add(0, this);
GroovyClassDoc next = this;
@@ -289,12 +289,12 @@ public List<GroovyClassDoc> getParentClasses() {
}

public Set<GroovyClassDoc> getParentInterfaces() {
Set<GroovyClassDoc> result = new LinkedHashSet<GroovyClassDoc>();
Set<GroovyClassDoc> result = new LinkedHashSet<>();
result.add(this);
Set<GroovyClassDoc> next = new LinkedHashSet<GroovyClassDoc>(Arrays.asList(this.interfaces()));
Set<GroovyClassDoc> next = new LinkedHashSet<>(Arrays.asList(this.interfaces()));
while (!next.isEmpty()) {
Set<GroovyClassDoc> temp = next;
next = new LinkedHashSet<GroovyClassDoc>();
next = new LinkedHashSet<>();
for (GroovyClassDoc t : temp) {
if (t instanceof SimpleGroovyClassDoc) {
next.addAll(((SimpleGroovyClassDoc)t).getParentInterfaces());
@@ -310,7 +310,7 @@ public Set<GroovyClassDoc> getParentInterfaces() {
}

private Set<GroovyClassDoc> getJavaInterfaces(ExternalGroovyClassDoc d) {
Set<GroovyClassDoc> result = new LinkedHashSet<GroovyClassDoc>();
Set<GroovyClassDoc> result = new LinkedHashSet<>();
Class[] interfaces = d.externalClass().getInterfaces();
if (interfaces != null) {
for (Class i : interfaces) {
@@ -476,7 +476,7 @@ public static String getDocUrl(String type, boolean full, List<LinkArgument> lin
if (gt != -1) {
if (gt > lt) {
String allTypeArgs = type.substring(lt + 1, gt);
List<String> typeArgs = new ArrayList<String>();
List<String> typeArgs = new ArrayList<>();
int nested = 0;
StringBuilder sb = new StringBuilder();
for (char ch : allTypeArgs.toCharArray()) {
@@ -492,7 +492,7 @@ else if (ch == ',' && nested == 0) {
if (sb.length() > 0) {
typeArgs.add(sb.toString().trim());
}
List<String> typeUrls = new ArrayList<String>();
List<String> typeUrls = new ArrayList<>();
for (String typeArg : typeArgs) {
typeUrls.add(getDocUrl(typeArg, full, links, relativePath, rootDoc, classDoc));
}
@@ -969,7 +969,7 @@ public String replaceAllTagsCollated(String self, String preKey, String postKey,
Matcher matcher = regex.matcher(self + " @endMarker");
if (matcher.find()) {
matcher.reset();
Map<String, List<String>> savedTags = new LinkedHashMap<String, List<String>>();
Map<String, List<String>> savedTags = new LinkedHashMap<>();
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String tagname = matcher.group(1);

0 comments on commit cf45a0d

Please sign in to comment.