diff --git a/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java b/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java index ad8fe02dd3..d28dee70c9 100644 --- a/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java +++ b/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java @@ -466,7 +466,7 @@ private Tag trimNSAttributes(Tag tag) { if (remove == 0) { return tag; } else { - List attrList = new ArrayList(attr.length); + List attrList = new ArrayList<>(attr.length); int p = 0; for (int i = 0; i < attr.length; i++) { p = 1 << i; @@ -475,7 +475,7 @@ private Tag trimNSAttributes(Tag tag) { } attrList.add(attr[i]); } - attr = (TagAttribute[]) attrList.toArray(new TagAttribute[attrList.size()]); + attr = attrList.toArray(new TagAttribute[attrList.size()]); return new Tag(tag.getLocation(), tag.getNamespace(), tag.getLocalName(), tag.getQName(), new TagAttributesImpl(attr)); } } diff --git a/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationUnit.java b/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationUnit.java index 2dc6884f55..0d36ede365 100644 --- a/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationUnit.java +++ b/impl/src/main/java/com/sun/faces/facelets/compiler/CompilationUnit.java @@ -43,7 +43,7 @@ public String toString() { } }; - private List children; + private List children; public CompilationUnit() { } @@ -58,7 +58,7 @@ protected void finishNotify(CompilationManager manager) { public void addChild(CompilationUnit unit) { if (children == null) { - children = new ArrayList(); + children = new ArrayList<>(); } children.add(unit); } @@ -76,12 +76,12 @@ protected final FaceletHandler getNextFaceletHandler() { return LEAF; } if (children.size() == 1) { - CompilationUnit u = (CompilationUnit) children.get(0); + CompilationUnit u = children.get(0); return u.createFaceletHandler(); } FaceletHandler[] fh = new FaceletHandler[children.size()]; for (int i = 0; i < fh.length; i++) { - fh[i] = ((CompilationUnit) children.get(i)).createFaceletHandler(); + fh[i] = children.get(i).createFaceletHandler(); } return new CompositeFaceletHandler(fh); } diff --git a/impl/src/main/java/com/sun/faces/facelets/compiler/Compiler.java b/impl/src/main/java/com/sun/faces/facelets/compiler/Compiler.java index 485039894e..d6e99c7425 100644 --- a/impl/src/main/java/com/sun/faces/facelets/compiler/Compiler.java +++ b/impl/src/main/java/com/sun/faces/facelets/compiler/Compiler.java @@ -60,11 +60,11 @@ public abstract class Compiler { private boolean trimmingComments = false; - private final List libraries = new ArrayList(); + private final List libraries = new ArrayList<>(); - private final List decorators = new ArrayList(); + private final List decorators = new ArrayList<>(); - private final Map features = new HashMap(); + private final Map features = new HashMap<>(); /** * @@ -90,7 +90,7 @@ public final FaceletHandler metadataCompile(URL src, String alias) throws IOExce public final TagDecorator createTagDecorator() { if (decorators.size() > 0) { - return new CompositeTagDecorator((TagDecorator[]) decorators.toArray(new TagDecorator[decorators.size()])); + return new CompositeTagDecorator(decorators.toArray(new TagDecorator[decorators.size()])); } return EMPTY_DECORATOR; } @@ -127,7 +127,7 @@ public final ExpressionFactory createExpressionFactory() { } private final Object featureInstance(String name) { - String type = (String) features.get(name); + String type = features.get(name); if (type != null) { try { return ReflectionUtil.forName(type).newInstance(); @@ -140,7 +140,7 @@ private final Object featureInstance(String name) { public final TagLibrary createTagLibrary(CompilationMessageHolder unit) { if (libraries.size() > 0) { - return new CompositeTagLibrary((TagLibrary[]) libraries.toArray(new TagLibrary[libraries.size()]), unit); + return new CompositeTagLibrary(libraries.toArray(new TagLibrary[libraries.size()]), unit); } return EMPTY_LIBRARY; } @@ -157,7 +157,7 @@ public final void setFeature(String name, String value) { } public final String getFeature(String name) { - return (String) features.get(name); + return features.get(name); } public final boolean isTrimmingComments() { diff --git a/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceHandler.java b/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceHandler.java index 31a9c300b0..1c7bbb0124 100644 --- a/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceHandler.java +++ b/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceHandler.java @@ -34,10 +34,10 @@ final class NamespaceHandler extends FunctionMapper implements FaceletHandler { private final TagLibrary library; - private final Map ns; + private final Map ns; private FaceletHandler next; - public NamespaceHandler(FaceletHandler next, TagLibrary library, Map ns) { + public NamespaceHandler(FaceletHandler next, TagLibrary library, Map ns) { this.library = library; this.ns = ns; this.next = next; @@ -57,7 +57,7 @@ public void apply(FaceletContext ctx, UIComponent parent) throws IOException { @Override public Method resolveFunction(String prefix, String localName) { - String uri = (String) ns.get(prefix); + String uri = ns.get(prefix); if (uri != null) { return library.createFunction(uri, localName); } diff --git a/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceManager.java b/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceManager.java index c056995104..3f273f6578 100644 --- a/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceManager.java +++ b/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceManager.java @@ -38,13 +38,13 @@ public NS(String prefix, String ns) { } } - private final List namespaces; + private final List namespaces; /** * */ public NamespaceManager() { - namespaces = new ArrayList(); + namespaces = new ArrayList<>(); } public void reset() { @@ -59,7 +59,7 @@ public void pushNamespace(String prefix, String namespace) { public String getNamespace(String prefix) { NS ns = null; for (int i = 0; i < namespaces.size(); i++) { - ns = (NS) namespaces.get(i); + ns = namespaces.get(i); if (ns.prefix.equals(prefix)) { return ns.namespace; } @@ -70,7 +70,7 @@ public String getNamespace(String prefix) { public void popNamespace(String prefix) { NS ns = null; for (int i = 0; i < namespaces.size(); i++) { - ns = (NS) namespaces.get(i); + ns = namespaces.get(i); if (ns.prefix.equals(prefix)) { namespaces.remove(i); return; @@ -83,7 +83,7 @@ public NamespaceUnit toNamespaceUnit(TagLibrary library) { if (namespaces.size() > 0) { NS ns = null; for (int i = namespaces.size() - 1; i >= 0; i--) { - ns = (NS) namespaces.get(i); + ns = namespaces.get(i); unit.setNamespace(ns.prefix, ns.namespace); } } diff --git a/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceUnit.java b/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceUnit.java index 02add7d70a..dbf82f9af2 100644 --- a/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceUnit.java +++ b/impl/src/main/java/com/sun/faces/facelets/compiler/NamespaceUnit.java @@ -30,7 +30,7 @@ */ final class NamespaceUnit extends CompilationUnit { - private final Map ns = new HashMap(); + private final Map ns = new HashMap<>(); private final TagLibrary library; public NamespaceUnit(TagLibrary library) { diff --git a/impl/src/main/java/com/sun/faces/facelets/compiler/UILeaf.java b/impl/src/main/java/com/sun/faces/facelets/compiler/UILeaf.java index 67c2f3b3f5..defac696f7 100644 --- a/impl/src/main/java/com/sun/faces/facelets/compiler/UILeaf.java +++ b/impl/src/main/java/com/sun/faces/facelets/compiler/UILeaf.java @@ -35,12 +35,12 @@ public class UILeaf extends UIComponentBase implements UntargetableComponent { - private final static Map facets = new HashMap(0, 1.0f) { + private final static Map facets = new HashMap<>(0, 1.0f) { private static final long serialVersionUID = 2063657587950149152L; - @Override - public void putAll(Map map) { +// @Override + public void putAll(Map map) { // do nothing }