From 3359b6cb51bdd7aac3102c706c678a593f7f077f Mon Sep 17 00:00:00 2001 From: Michael Yan Date: Wed, 28 Sep 2022 00:26:23 +0800 Subject: [PATCH] Replace explicit type argument with diamond operator --- .../main/groovy/org/grails/gsp/GroovyPage.java | 2 +- .../org/grails/gsp/GroovyPageMetaInfo.java | 2 +- .../grails/gsp/GroovyPagesTemplateEngine.java | 6 +++--- .../gsp/compiler/GroovyPageExpressionParser.java | 2 +- .../grails/gsp/compiler/GroovyPageParser.java | 16 ++++++++-------- .../grails/gsp/compiler/GroovyPageScanner.java | 2 +- .../gsp/compiler/tags/GrailsTagRegistry.java | 2 +- .../gsp/compiler/tags/GroovySyntaxTag.java | 2 +- .../transform/GroovyPageInjectionOperation.java | 2 +- .../transform/GroovyPageOptimizerVisitor.java | 2 +- .../compiler/transform/LineNumberTransform.java | 2 +- .../CachingGroovyPageStaticResourceLocator.java | 2 +- .../grails/gsp/io/DefaultGroovyPageLocator.java | 6 +++--- .../core/artefact/gsp/TagLibArtefactHandler.java | 6 +++--- .../core/gsp/DefaultGrailsTagLibClass.java | 6 +++--- .../groovy/org/grails/taglib/TagBodyClosure.java | 2 +- .../org/grails/taglib/TagLibraryLookup.java | 6 +++--- .../grails/taglib/TemplateVariableBinding.java | 4 ++-- .../taglib/encoder/OutputEncodingStack.java | 2 +- .../web/pages/StandaloneTagLibraryLookup.java | 2 +- .../web/gsp/GroovyPagesTemplateRenderer.java | 2 +- .../org/grails/web/pages/GroovyPagesServlet.java | 2 +- .../web/servlet/view/GroovyPageViewResolver.java | 2 +- .../jsp/GroovyPagesJspApplicationContext.java | 2 +- .../web/taglib/jsp/JspInvokeGrailsTagLibTag.java | 10 +++++----- .../org/grails/web/sitemesh/FactoryHolder.java | 2 +- .../web/sitemesh/GroovyPageLayoutFinder.java | 4 ++-- .../web/sitemesh/SpringMVCViewDecorator.java | 2 +- .../web/taglib/TagLibraryTransformer.java | 4 ++-- .../org/grails/web/taglib/LayoutWriterStack.java | 6 +++--- .../WebRequestTemplateVariableBinding.java | 6 +++--- 31 files changed, 59 insertions(+), 59 deletions(-) diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPage.java b/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPage.java index 7f4a17f6..d45f9eea 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPage.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPage.java @@ -131,7 +131,7 @@ public abstract class GroovyPage extends Script { private Encoder rawEncoder; - private final List> bodyClosures = new ArrayList>(15); + private final List> bodyClosures = new ArrayList<>(15); public GroovyPage() { init(); diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPageMetaInfo.java b/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPageMetaInfo.java index e8f27627..969d836d 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPageMetaInfo.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPageMetaInfo.java @@ -125,7 +125,7 @@ public class GroovyPageMetaInfo implements GrailsApplicationAware { private boolean initialized = false; - private CacheEntry shouldReloadCacheEntry = new CacheEntry(); + private CacheEntry shouldReloadCacheEntry = new CacheEntry<>(); public static String DEFAULT_PLUGIN_PATH = ""; diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPagesTemplateEngine.java b/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPagesTemplateEngine.java index 63e03801..bf143d7c 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPagesTemplateEngine.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/GroovyPagesTemplateEngine.java @@ -104,7 +104,7 @@ public class GroovyPagesTemplateEngine extends ResourceAwareTemplateEngine private static File dumpLineNumbersTo; - private ConcurrentMap> pageCache = new ConcurrentHashMap>(); + private ConcurrentMap> pageCache = new ConcurrentHashMap<>(); private ClassLoader classLoader; @@ -126,7 +126,7 @@ public class GroovyPagesTemplateEngine extends ResourceAwareTemplateEngine private Map> cachedDomainsWithoutPackage; - private List groovyPageSourceDecorators = new ArrayList(); + private List groovyPageSourceDecorators = new ArrayList<>(); static { String dirPath = System.getProperty("grails.dump.gsp.line.numbers.to.dir"); @@ -778,7 +778,7 @@ public Map> getDomainClassMap() { * to prevent using the static cache that was used previously. */ private Map> createDomainClassMap() { - Map> domainsWithoutPackage = new HashMap>(); + Map> domainsWithoutPackage = new HashMap<>(); if (this.grailsApplication != null) { GrailsClass[] domainClasses = this.grailsApplication.getArtefacts(DomainClassArtefactHandler.TYPE); for (GrailsClass domainClass : domainClasses) { diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageExpressionParser.java b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageExpressionParser.java index 84c5d6a9..d28f61d6 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageExpressionParser.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageExpressionParser.java @@ -38,7 +38,7 @@ private enum ParsingState { char nextTerminationChar; - Stack parsingStateStack = new Stack(); + Stack parsingStateStack = new Stack<>(); boolean containsGstrings = false; diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageParser.java b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageParser.java index 3330490f..3aaf3458 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageParser.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageParser.java @@ -143,19 +143,19 @@ public class GroovyPageParser implements Tokens { private Map tagContext; - private Stack tagMetaStack = new Stack(); + private Stack tagMetaStack = new Stack<>(); private GrailsTagRegistry tagRegistry = GrailsTagRegistry.getInstance(); private Environment environment; - private List htmlParts = new ArrayList(); + private List htmlParts = new ArrayList<>(); private static SitemeshPreprocessor sitemeshPreprocessor = new SitemeshPreprocessor(); - Set bodyVarsDefined = new HashSet(); + Set bodyVarsDefined = new HashSet<>(); - Map attrsVarsMapDefinition = new HashMap(); + Map attrsVarsMapDefinition = new HashMap<>(); int closureLevel = 0; @@ -183,7 +183,7 @@ public class GroovyPageParser implements Tokens { private int constantCount = 0; - private Map constantsToNumbers = new HashMap(); + private Map constantsToNumbers = new HashMap<>(); private final String pageName; @@ -233,7 +233,7 @@ public class GroovyPageParser implements Tokens { public static final String GROOVY_SOURCE_CHAR_ENCODING = "UTF-8"; - private Map jspTags = new HashMap(); + private Map jspTags = new HashMap<>(); private long lastModified; @@ -370,7 +370,7 @@ else if (keepDirObj != null) { } private Map parseDirectives(String gspSource) { - Map result = new HashMap(); + Map result = new HashMap<>(); // strip gsp comments String input = PRESCAN_COMMENT_PATTERN.matcher(gspSource).replaceAll(""); // find page directives @@ -598,7 +598,7 @@ private void directPage(String text) { private void directJspTagLib(String text) { text = text.substring(TAGLIB_DIRECTIVE.length() + 1, text.length()); - Map attrs = new LinkedHashMap(); + Map attrs = new LinkedHashMap<>(); populateMapWithAttributes(attrs, text); String prefix = attrs.get("\"prefix\""); diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageScanner.java b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageScanner.java index 0fd848f9..b14bb1ad 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageScanner.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageScanner.java @@ -76,7 +76,7 @@ class GroovyPageScanner implements Tokens { // add line starting positions to array private void resolveLineNumberPositions() { - this.lineNumberPositions = new ArrayList(); + this.lineNumberPositions = new ArrayList<>(); // first line starts at 0 this.lineNumberPositions.add(0); for (int i = 0; i < this.len; i++) { diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/tags/GrailsTagRegistry.java b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/tags/GrailsTagRegistry.java index 422c73d0..37d6a8a3 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/tags/GrailsTagRegistry.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/tags/GrailsTagRegistry.java @@ -29,7 +29,7 @@ public final class GrailsTagRegistry { private static GrailsTagRegistry instance = new GrailsTagRegistry(); - private static Map> tagRegistry = new ConcurrentHashMap>(); + private static Map> tagRegistry = new ConcurrentHashMap<>(); static { instance.registerTag(GroovyEachTag.TAG_NAME, GroovyEachTag.class); diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/tags/GroovySyntaxTag.java b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/tags/GroovySyntaxTag.java index 2c1d9210..e311c73b 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/tags/GroovySyntaxTag.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/tags/GroovySyntaxTag.java @@ -57,7 +57,7 @@ public abstract class GroovySyntaxTag implements GrailsTag { protected PrintWriter out; - protected Map attributes = new HashMap(); + protected Map attributes = new HashMap<>(); protected GroovyPageParser parser; diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/GroovyPageInjectionOperation.java b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/GroovyPageInjectionOperation.java index 2187e327..69e434c1 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/GroovyPageInjectionOperation.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/GroovyPageInjectionOperation.java @@ -55,7 +55,7 @@ public void call(SourceUnit source, GeneratorContext context, ClassNode classNod private GroovyPageInjector[] getGroovyPageInjectors() { if (this.groovyPageInjectors == null) { - List injectors = new ArrayList(); + List injectors = new ArrayList<>(); for (ClassInjector ci : getClassInjectors()) { if (ci instanceof GroovyPageInjector) { injectors.add((GroovyPageInjector) ci); diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/GroovyPageOptimizerVisitor.java b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/GroovyPageOptimizerVisitor.java index 7c9e451f..c8dd4394 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/GroovyPageOptimizerVisitor.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/GroovyPageOptimizerVisitor.java @@ -60,7 +60,7 @@ class GroovyPageOptimizerVisitor extends CodeVisitorSupport { private static final String EXPRESSIONOUT_RECEIVER = "expressionOut"; - private Stack innerClosures = new Stack(); + private Stack innerClosures = new Stack<>(); private ClassNode targetGroovyPageNode; diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/LineNumberTransform.java b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/LineNumberTransform.java index e92ebea4..3df3a37b 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/LineNumberTransform.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/transform/LineNumberTransform.java @@ -131,7 +131,7 @@ AnnotationNode findAnnotation(ClassNode clazz) { int[] extractLineNumberArray(AnnotationNode node) { ListExpression lineNumberArray = (ListExpression) node.getMember("lines"); // make assumption that this is a simple array of constants - List numbers = new ArrayList(); + List numbers = new ArrayList<>(); for (Expression e : lineNumberArray.getExpressions()) { if (e instanceof ConstantExpression) { numbers.add((Integer) ((ConstantExpression) e).getValue()); diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/io/CachingGroovyPageStaticResourceLocator.java b/grails-gsp/src/main/groovy/org/grails/gsp/io/CachingGroovyPageStaticResourceLocator.java index 751aa89a..e8751c4f 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/io/CachingGroovyPageStaticResourceLocator.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/io/CachingGroovyPageStaticResourceLocator.java @@ -32,7 +32,7 @@ */ public class CachingGroovyPageStaticResourceLocator extends GroovyPageStaticResourceLocator { - private ConcurrentMap> uriResolveCache = new ConcurrentHashMap>(); + private ConcurrentMap> uriResolveCache = new ConcurrentHashMap<>(); private long cacheTimeout = -1; diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/io/DefaultGroovyPageLocator.java b/grails-gsp/src/main/groovy/org/grails/gsp/io/DefaultGroovyPageLocator.java index 57537361..993cab98 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/io/DefaultGroovyPageLocator.java +++ b/grails-gsp/src/main/groovy/org/grails/gsp/io/DefaultGroovyPageLocator.java @@ -69,7 +69,7 @@ public class DefaultGroovyPageLocator implements GroovyPageLocator, ResourceLoad private static final String BLANK = ""; - protected Collection resourceLoaders = new ConcurrentLinkedQueue(); + protected Collection resourceLoaders = new ConcurrentLinkedQueue<>(); protected GrailsPluginManager pluginManager; @@ -79,7 +79,7 @@ public class DefaultGroovyPageLocator implements GroovyPageLocator, ResourceLoad protected boolean reloadEnabled = !this.warDeployed; - private Set reloadedPrecompiledGspClassNames = new CopyOnWriteArraySet(); + private Set reloadedPrecompiledGspClassNames = new CopyOnWriteArraySet<>(); public void setResourceLoader(ResourceLoader resourceLoader) { addResourceLoader(resourceLoader); @@ -96,7 +96,7 @@ public void setPrecompiledGspMap(Map precompiledGspMap) { this.precompiledGspMap = null; } else { - this.precompiledGspMap = new ConcurrentHashMap(precompiledGspMap); + this.precompiledGspMap = new ConcurrentHashMap<>(precompiledGspMap); } } diff --git a/grails-taglib/src/main/groovy/org/grails/core/artefact/gsp/TagLibArtefactHandler.java b/grails-taglib/src/main/groovy/org/grails/core/artefact/gsp/TagLibArtefactHandler.java index e610708f..cff10d1e 100644 --- a/grails-taglib/src/main/groovy/org/grails/core/artefact/gsp/TagLibArtefactHandler.java +++ b/grails-taglib/src/main/groovy/org/grails/core/artefact/gsp/TagLibArtefactHandler.java @@ -42,9 +42,9 @@ public class TagLibArtefactHandler extends ArtefactHandlerAdapter { public static final String TYPE = "TagLib"; - private Map tag2libMap = new HashMap(); + private Map tag2libMap = new HashMap<>(); - private Map namespace2tagLibMap = new HashMap(); + private Map namespace2tagLibMap = new HashMap<>(); public TagLibArtefactHandler() { super(TYPE, GrailsTagLibClass.class, DefaultGrailsTagLibClass.class, TYPE); @@ -60,7 +60,7 @@ public String getPluginName() { */ @Override public void initialize(ArtefactInfo artefacts) { - this.tag2libMap = new HashMap(); + this.tag2libMap = new HashMap<>(); for (GrailsClass aClass : artefacts.getGrailsClasses()) { GrailsTagLibClass taglibClass = (GrailsTagLibClass) aClass; String namespace = taglibClass.getNamespace(); diff --git a/grails-taglib/src/main/groovy/org/grails/core/gsp/DefaultGrailsTagLibClass.java b/grails-taglib/src/main/groovy/org/grails/core/gsp/DefaultGrailsTagLibClass.java index 8ed9d550..aba31a12 100644 --- a/grails-taglib/src/main/groovy/org/grails/core/gsp/DefaultGrailsTagLibClass.java +++ b/grails-taglib/src/main/groovy/org/grails/core/gsp/DefaultGrailsTagLibClass.java @@ -41,15 +41,15 @@ public class DefaultGrailsTagLibClass extends org.grails.core.DefaultGrailsTagLi protected static final String TAG_LIB = TagLibArtefactHandler.TYPE; - private Set tags = new HashSet(); + private Set tags = new HashSet<>(); private String namespace = GrailsTagLibClass.DEFAULT_NAMESPACE; - private Set returnObjectForTagsSet = new HashSet(); + private Set returnObjectForTagsSet = new HashSet<>(); private Object defaultEncodeAs = null; - private Map encodeAsForTags = new HashMap(); + private Map encodeAsForTags = new HashMap<>(); /** * Default contructor. diff --git a/grails-taglib/src/main/groovy/org/grails/taglib/TagBodyClosure.java b/grails-taglib/src/main/groovy/org/grails/taglib/TagBodyClosure.java index b664817e..42c9271f 100644 --- a/grails-taglib/src/main/groovy/org/grails/taglib/TagBodyClosure.java +++ b/grails-taglib/src/main/groovy/org/grails/taglib/TagBodyClosure.java @@ -155,7 +155,7 @@ private void restoreItVariable(Binding currentBinding, Object originalIt) { */ @SuppressWarnings("unchecked") private Map addAndSaveVariables(Binding binding, Map args) { - Map savedVariablesMap = new LinkedHashMap(); + Map savedVariablesMap = new LinkedHashMap<>(); for (Iterator i = args.keySet().iterator(); i.hasNext(); ) { String varname = String.valueOf(i.next()); savedVariablesMap.put(varname, binding.getVariable(varname)); diff --git a/grails-taglib/src/main/groovy/org/grails/taglib/TagLibraryLookup.java b/grails-taglib/src/main/groovy/org/grails/taglib/TagLibraryLookup.java index 0773e8a7..7a2a4aec 100644 --- a/grails-taglib/src/main/groovy/org/grails/taglib/TagLibraryLookup.java +++ b/grails-taglib/src/main/groovy/org/grails/taglib/TagLibraryLookup.java @@ -53,9 +53,9 @@ public class TagLibraryLookup implements ApplicationContextAware, GrailsApplicat protected Map namespaceDispatchers = new HashMap<>(); - protected Map> tagsThatReturnObjectForNamespace = new HashMap>(); + protected Map> tagsThatReturnObjectForNamespace = new HashMap<>(); - protected Map>> encodeAsForTagNamespaces = new HashMap>>(); + protected Map>> encodeAsForTagNamespaces = new HashMap<>(); @Override public void afterPropertiesSet() throws Exception { @@ -119,7 +119,7 @@ private void registerTagLib(GrailsTagLibClass taglib, boolean isInitialization) } Set tagsThatReturnObject = this.tagsThatReturnObjectForNamespace.get(namespace); if (tagsThatReturnObject == null) { - tagsThatReturnObject = new HashSet(); + tagsThatReturnObject = new HashSet<>(); this.tagsThatReturnObjectForNamespace.put(namespace, tagsThatReturnObject); } Map tags = this.tagNamespaces.get(namespace); diff --git a/grails-taglib/src/main/groovy/org/grails/taglib/TemplateVariableBinding.java b/grails-taglib/src/main/groovy/org/grails/taglib/TemplateVariableBinding.java index 9501fef0..afd71b03 100644 --- a/grails-taglib/src/main/groovy/org/grails/taglib/TemplateVariableBinding.java +++ b/grails-taglib/src/main/groovy/org/grails/taglib/TemplateVariableBinding.java @@ -36,7 +36,7 @@ public class TemplateVariableBinding extends AbstractTemplateVariableBinding { private Object owner; - private Set cachedParentVariableNames = new HashSet(); + private Set cachedParentVariableNames = new HashSet<>(); private boolean root; @@ -196,7 +196,7 @@ public void setRoot(boolean root) { @SuppressWarnings("unchecked") @Override public Set getVariableNames() { - Set variableNames = new HashSet(); + Set variableNames = new HashSet<>(); if (this.parent != null) { if (this.parent instanceof AbstractTemplateVariableBinding) { variableNames.addAll(((AbstractTemplateVariableBinding) this.parent).getVariableNames()); diff --git a/grails-taglib/src/main/groovy/org/grails/taglib/encoder/OutputEncodingStack.java b/grails-taglib/src/main/groovy/org/grails/taglib/encoder/OutputEncodingStack.java index b888e804..c9531c7a 100644 --- a/grails-taglib/src/main/groovy/org/grails/taglib/encoder/OutputEncodingStack.java +++ b/grails-taglib/src/main/groovy/org/grails/taglib/encoder/OutputEncodingStack.java @@ -157,7 +157,7 @@ private static OutputEncodingStack createNew(OutputEncodingStackAttributes attri } private static OutputEncodingStack lookupStack(OutputContext outputContext) { - OutputEncodingStack outputStack = (OutputEncodingStack) outputContext.getCurrentOutputEncodingStack(); + OutputEncodingStack outputStack = outputContext.getCurrentOutputEncodingStack(); return outputStack; } diff --git a/grails-web-gsp-taglib/src/main/groovy/org/grails/web/pages/StandaloneTagLibraryLookup.java b/grails-web-gsp-taglib/src/main/groovy/org/grails/web/pages/StandaloneTagLibraryLookup.java index 323fe2d8..c415b22e 100644 --- a/grails-web-gsp-taglib/src/main/groovy/org/grails/web/pages/StandaloneTagLibraryLookup.java +++ b/grails-web-gsp-taglib/src/main/groovy/org/grails/web/pages/StandaloneTagLibraryLookup.java @@ -68,7 +68,7 @@ protected void putTagLib(Map tags, String name, GrailsTagLibClas } public void setTagLibInstances(List tagLibInstances) { - this.tagLibInstancesSet = new LinkedHashSet(); + this.tagLibInstancesSet = new LinkedHashSet<>(); this.tagLibInstancesSet.addAll(tagLibInstances); } diff --git a/grails-web-gsp/src/main/groovy/org/grails/web/gsp/GroovyPagesTemplateRenderer.java b/grails-web-gsp/src/main/groovy/org/grails/web/gsp/GroovyPagesTemplateRenderer.java index 2e8ddc69..78f3acb1 100644 --- a/grails-web-gsp/src/main/groovy/org/grails/web/gsp/GroovyPagesTemplateRenderer.java +++ b/grails-web-gsp/src/main/groovy/org/grails/web/gsp/GroovyPagesTemplateRenderer.java @@ -76,7 +76,7 @@ public class GroovyPagesTemplateRenderer implements InitializingBean { private GroovyPagesTemplateEngine groovyPagesTemplateEngine; - private ConcurrentMap> templateCache = new ConcurrentHashMap>(); + private ConcurrentMap> templateCache = new ConcurrentHashMap<>(); private Object scaffoldingTemplateGenerator; diff --git a/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPagesServlet.java b/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPagesServlet.java index 0ba2f787..501ec874 100644 --- a/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPagesServlet.java +++ b/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPagesServlet.java @@ -113,7 +113,7 @@ protected ServletRequestAttributes buildRequestAttributes(HttpServletRequest req private GrailsPluginManager pluginManager; @SuppressWarnings("rawtypes") - private Map binaryPluginViewsMap = new ConcurrentHashMap(); + private Map binaryPluginViewsMap = new ConcurrentHashMap<>(); @Override protected void initFrameworkServlet() throws BeansException { diff --git a/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java b/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java index 4b18d16c..ca8c3be0 100644 --- a/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java +++ b/grails-web-gsp/src/main/groovy/org/grails/web/servlet/view/GroovyPageViewResolver.java @@ -61,7 +61,7 @@ public class GroovyPageViewResolver extends InternalResourceViewResolver impleme protected GrailsConventionGroovyPageLocator groovyPageLocator; - private ConcurrentMap> viewCache = new ConcurrentHashMap>(); + private ConcurrentMap> viewCache = new ConcurrentHashMap<>(); private boolean allowGrailsViewCaching = !GrailsUtil.isDevelopmentEnv(); diff --git a/grails-web-jsp/src/main/groovy/org/grails/gsp/jsp/GroovyPagesJspApplicationContext.java b/grails-web-jsp/src/main/groovy/org/grails/gsp/jsp/GroovyPagesJspApplicationContext.java index 38787389..2c1e1499 100644 --- a/grails-web-jsp/src/main/groovy/org/grails/gsp/jsp/GroovyPagesJspApplicationContext.java +++ b/grails-web-jsp/src/main/groovy/org/grails/gsp/jsp/GroovyPagesJspApplicationContext.java @@ -50,7 +50,7 @@ public class GroovyPagesJspApplicationContext implements JspApplicationContext { private static final ExpressionFactory expressionFactoryImpl = findExpressionFactoryImplementation(); - private final LinkedList listeners = new LinkedList(); + private final LinkedList listeners = new LinkedList<>(); private final CompositeELResolver elResolver = new CompositeELResolver(); diff --git a/grails-web-jsp/src/main/groovy/org/grails/web/taglib/jsp/JspInvokeGrailsTagLibTag.java b/grails-web-jsp/src/main/groovy/org/grails/web/taglib/jsp/JspInvokeGrailsTagLibTag.java index 651dd9b7..86f72a92 100644 --- a/grails-web-jsp/src/main/groovy/org/grails/web/taglib/jsp/JspInvokeGrailsTagLibTag.java +++ b/grails-web-jsp/src/main/groovy/org/grails/web/taglib/jsp/JspInvokeGrailsTagLibTag.java @@ -75,13 +75,13 @@ public class JspInvokeGrailsTagLibTag extends BodyTagSupport implements DynamicA private int invocationCount; - private List invocationArgs = new ArrayList(); + private List invocationArgs = new ArrayList<>(); - private List invocationBodyContent = new ArrayList(); + private List invocationBodyContent = new ArrayList<>(); private BeanWrapper bean; - protected Map attributes = new HashMap(); + protected Map attributes = new HashMap<>(); private FastStringPrintWriter sw; @@ -120,7 +120,7 @@ public final int doStartTag() throws JspException { if (trimmed.startsWith("[") && trimmed.endsWith("]")) { trimmed = trimmed.substring(1, trimmed.length() - 1); Matcher m = ATTRIBUTE_MAP.matcher(trimmed); - Map attributeMap = new HashMap(); + Map attributeMap = new HashMap<>(); while (m.find()) { String attributeName = m.group(1); String attributeValue = m.group(2); @@ -337,7 +337,7 @@ public final void setDynamicAttribute(String uri, String localName, Object value if (trimmed.startsWith("[") && trimmed.endsWith("]")) { trimmed = trimmed.substring(1, trimmed.length() - 1); Matcher m = ATTRIBUTE_MAP.matcher(trimmed); - Map attributeMap = new HashMap(); + Map attributeMap = new HashMap<>(); while (m.find()) { String attributeName = m.group(1); String attributeValue = m.group(2); diff --git a/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/FactoryHolder.java b/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/FactoryHolder.java index 2e7b55bf..a0c27afe 100644 --- a/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/FactoryHolder.java +++ b/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/FactoryHolder.java @@ -27,7 +27,7 @@ */ public final class FactoryHolder { - private static Holder holder = new Holder("factory"); + private static Holder holder = new Holder<>("factory"); private FactoryHolder() { // static only diff --git a/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/GroovyPageLayoutFinder.java b/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/GroovyPageLayoutFinder.java index ad450779..776a71bd 100644 --- a/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/GroovyPageLayoutFinder.java +++ b/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/GroovyPageLayoutFinder.java @@ -68,9 +68,9 @@ public class GroovyPageLayoutFinder implements ApplicationListener decoratorCache = new ConcurrentHashMap(); + private Map decoratorCache = new ConcurrentHashMap<>(); - private Map layoutDecoratorCache = new ConcurrentHashMap(); + private Map layoutDecoratorCache = new ConcurrentHashMap<>(); private String defaultDecoratorName; diff --git a/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/SpringMVCViewDecorator.java b/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/SpringMVCViewDecorator.java index d2b697c1..360abe6f 100644 --- a/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/SpringMVCViewDecorator.java +++ b/grails-web-sitemesh/src/main/groovy/org/grails/web/sitemesh/SpringMVCViewDecorator.java @@ -52,7 +52,7 @@ public SpringMVCViewDecorator(String name, View view) { public void render(Content content, SiteMeshContext context) { SiteMeshWebAppContext ctx = (SiteMeshWebAppContext) context; - render(content, Collections.emptyMap(), ctx.getRequest(), ctx.getResponse(), ctx.getServletContext()); + render(content, Collections.emptyMap(), ctx.getRequest(), ctx.getResponse(), ctx.getServletContext()); } public void render(Content content, Map model, HttpServletRequest request, diff --git a/grails-web-taglib/src/main/groovy/org/grails/compiler/web/taglib/TagLibraryTransformer.java b/grails-web-taglib/src/main/groovy/org/grails/compiler/web/taglib/TagLibraryTransformer.java index ed6201ab..5158de23 100644 --- a/grails-web-taglib/src/main/groovy/org/grails/compiler/web/taglib/TagLibraryTransformer.java +++ b/grails-web-taglib/src/main/groovy/org/grails/compiler/web/taglib/TagLibraryTransformer.java @@ -232,9 +232,9 @@ private boolean methodExists(ClassNode classNode, String methodName, Parameter[] } private List findTags(ClassNode classNode) { - List tags = new ArrayList(); + List tags = new ArrayList<>(); List properties = classNode.getProperties(); - List potentialAliases = new ArrayList(); + List potentialAliases = new ArrayList<>(); for (PropertyNode property : properties) { if (property.isPublic()) { Expression initialExpression = property.getInitialExpression(); diff --git a/grails-web-taglib/src/main/groovy/org/grails/web/taglib/LayoutWriterStack.java b/grails-web-taglib/src/main/groovy/org/grails/web/taglib/LayoutWriterStack.java index 834b7d92..6d7f8f7a 100644 --- a/grails-web-taglib/src/main/groovy/org/grails/web/taglib/LayoutWriterStack.java +++ b/grails-web-taglib/src/main/groovy/org/grails/web/taglib/LayoutWriterStack.java @@ -44,7 +44,7 @@ public class LayoutWriterStack { private static final String ATTRIBUTE_NAME_WRITER_STACK = "be.ixor.grails.gsptaglib.WRITER_STACK"; - private Stack> stack = new Stack>(); + private Stack> stack = new Stack<>(); /** * Returns a {@link Writer} where a layout part can write its contents to. @@ -91,7 +91,7 @@ public static Writer currentWriter(String name) { public static Map writeParts(Closure body) { LayoutWriterStack stack = LayoutWriterStack.currentStack(); stack.push(); - Map result = new HashMap(); + Map result = new HashMap<>(); result.put("body", body.call()); result.putAll(stack.pop()); return result; @@ -111,7 +111,7 @@ private static LayoutWriterStack currentStack() { } private void push() { - this.stack.push(new HashMap()); + this.stack.push(new HashMap<>()); } private Map pop() { diff --git a/grails-web-taglib/src/main/groovy/org/grails/web/taglib/WebRequestTemplateVariableBinding.java b/grails-web-taglib/src/main/groovy/org/grails/web/taglib/WebRequestTemplateVariableBinding.java index a6e7f6a7..dd368e98 100644 --- a/grails-web-taglib/src/main/groovy/org/grails/web/taglib/WebRequestTemplateVariableBinding.java +++ b/grails-web-taglib/src/main/groovy/org/grails/web/taglib/WebRequestTemplateVariableBinding.java @@ -42,9 +42,9 @@ public class WebRequestTemplateVariableBinding extends AbstractTemplateVariableB private final boolean developmentMode = Environment.isDevelopmentMode(); - private final Set requestAttributeVariables = new HashSet(); + private final Set requestAttributeVariables = new HashSet<>(); - private static final Map lazyRequestBasedValuesMap = new HashMap(); + private static final Map lazyRequestBasedValuesMap = new HashMap<>(); static { Map m = lazyRequestBasedValuesMap; @@ -170,7 +170,7 @@ public Set getVariableNames() { return lazyRequestBasedValuesMap.keySet(); } - Set variableNames = new HashSet(lazyRequestBasedValuesMap.keySet()); + Set variableNames = new HashSet<>(lazyRequestBasedValuesMap.keySet()); variableNames.addAll(getVariablesMap().keySet()); return variableNames; }