Skip to content

Commit

Permalink
Merge pull request #526 from syjer/remove-unused-code-4
Browse files Browse the repository at this point in the history
misc cleanup: remove unused method/helper files + add missing generics
  • Loading branch information
danfickle authored Aug 11, 2020
2 parents 4a8e0a3 + 885a5a5 commit b98f5b8
Show file tree
Hide file tree
Showing 70 changed files with 335 additions and 399 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static class Paragraph {
private final TreeMap<Integer, BidiTextRun> splitPoints;

// A map from Text nodes to their first index in the paragraph.
protected final Map<Text, Integer> textRuns = new HashMap<Text, Integer>();
protected final Map<Text, Integer> textRuns = new HashMap<>();

// One of LTR, RTL or AUTO.
protected final IdentValue cssDirection;
Expand All @@ -57,7 +57,7 @@ private Paragraph(IdentValue direction) {

private Paragraph(IdentValue direction, boolean isLiveImplementation) {
this.builder = isLiveImplementation ? new StringBuilder() : null;
this.splitPoints = isLiveImplementation ? new TreeMap<Integer, BidiTextRun>() : null;
this.splitPoints = isLiveImplementation ? new TreeMap<>() : null;
this.cssDirection = direction;
}

Expand Down Expand Up @@ -203,9 +203,9 @@ public void splitRoot(LayoutContext c, Document doc) {
Paragraph parent = isLiveImplementation ? new Paragraph(direction) : new FakeParagraph(direction);

if (isLiveImplementation) {
allParagraphs = new ArrayList<Paragraph>();
paragraphs = new HashMap<Text, Paragraph>();
blocks = new HashMap<Element, Paragraph>();
allParagraphs = new ArrayList<>();
paragraphs = new HashMap<>();
blocks = new HashMap<>();

splitParagraphs(c, doc, parent);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void setDocumentContext(SharedContext context, NamespaceHandler nsh, Docu
}

private List<Stylesheet> readAndParseAll(List<StylesheetInfo> infos, String medium) {
List<Stylesheet> result = new ArrayList<Stylesheet>(infos.size() + 15);
List<Stylesheet> result = new ArrayList<>(infos.size() + 15);

for (StylesheetInfo info : infos) {
if (info.appliesToMedia(medium)) {
Expand Down Expand Up @@ -243,7 +243,7 @@ public void flushAllStyleSheets() {
* @return The stylesheets value
*/
private List<StylesheetInfo> getStylesheets() {
List<StylesheetInfo> infos = new ArrayList<StylesheetInfo>();
List<StylesheetInfo> infos = new ArrayList<>();
long st = System.currentTimeMillis();

StylesheetInfo defaultStylesheet = _nsh.getDefaultStylesheet(_stylesheetFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ public static boolean isAbsoluteUnit(short type) {
case CSSPrimitiveValue.CSS_STRING:
return true;
case CSSPrimitiveValue.CSS_UNKNOWN:
XRLog.log(Level.WARNING, LogMessageId.LogMessageId0Param.CASCADE_IS_ABSOLUTE_CSS_UNKNOWN_GIVEN);
GeneralUtil.dumpShortException(new Exception());
XRLog.log(Level.WARNING, LogMessageId.LogMessageId0Param.CASCADE_IS_ABSOLUTE_CSS_UNKNOWN_GIVEN, new Exception());
// fall-through
default:
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public CascadedStyle getPECascadedStyle(Object e, String pseudoElement) {
}

public PageInfo getPageCascadedStyle(String pageName, String pseudoPage) {
List<PropertyDeclaration> props = new ArrayList<PropertyDeclaration> ();
Map<MarginBoxName, List<PropertyDeclaration>> marginBoxes = new HashMap<MarginBoxName, List<PropertyDeclaration>>();
List<PropertyDeclaration> props = new ArrayList<>();
Map<MarginBoxName, List<PropertyDeclaration>> marginBoxes = new HashMap<>();

for (PageRule pageRule : _pageRules) {
if (pageRule.applies(pageName, pseudoPage)) {
Expand Down Expand Up @@ -164,7 +164,7 @@ protected Mapper matchElement(Object e) {
}

Mapper createDocumentMapper(List<Stylesheet> stylesheets, String medium) {
java.util.TreeMap<String,Selector> sorter = new java.util.TreeMap<String,Selector>();
java.util.TreeMap<String,Selector> sorter = new java.util.TreeMap<>();
addAllStylesheets(stylesheets, sorter, medium);
XRLog.log(Level.INFO, LogMessageId.LogMessageId1Param.MATCH_MATCHER_CREATED_WITH_SELECTOR, sorter.size());
return new Mapper(sorter.values());
Expand Down Expand Up @@ -395,7 +395,7 @@ CascadedStyle getCascadedStyle(Object e) {
Ruleset elementStyling = getElementStyle(e);
Ruleset nonCssStyling = getNonCssStyle(e);

List<PropertyDeclaration> propList = new ArrayList<PropertyDeclaration>();
List<PropertyDeclaration> propList = new ArrayList<>();

// Specificity 0,0,0,0
if (nonCssStyling != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public CascadedStyle createMarginBoxStyle(MarginBoxName marginBox, boolean alway

List<PropertyDeclaration> all;
if (marginProps != null) {
all = new ArrayList<PropertyDeclaration>(marginProps.size() + 3);
all = new ArrayList<>(marginProps.size() + 3);
all.addAll(marginProps);
} else {
all = new ArrayList<PropertyDeclaration>(3);
all = new ArrayList<>(3);
}

all.add(CascadedStyle.createLayoutPropertyDeclaration(CSSName.DISPLAY, IdentValue.TABLE_CELL));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ Object getAppropriateSibling(Object e, TreeResolver treeRes) {
*/
private void addCondition(Condition c) {
if (conditions == null) {
conditions = new java.util.ArrayList<Condition>();
conditions = new java.util.ArrayList<>();
}
if (_pe != null) {
conditions.add(Condition.createUnsupportedCondition());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,8 @@ public List<PropertyDeclaration> buildDeclarations(
// [Century Gothic], [Arial sans-serif] (i.e. the comma is assumed
// after a string). Seems wrong per the spec, but FF (at least)
// does it in standards mode so we do too.
List<String> consecutiveIdents = new ArrayList<String>();
List<String> normalized = new ArrayList<String>(values.size());
List<String> consecutiveIdents = new ArrayList<>();
List<String> normalized = new ArrayList<>(values.size());
for (Iterator<PropertyValue> i = values.iterator(); i.hasNext(); ) {
PropertyValue value = i.next();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class PageRule implements RulesetContainer {
private Ruleset _ruleset;
private int _origin;

private final Map<MarginBoxName,List<PropertyDeclaration>> _marginBoxes = new HashMap<MarginBoxName,List<PropertyDeclaration>>();
private final Map<MarginBoxName,List<PropertyDeclaration>> _marginBoxes = new HashMap<>();

private int _pos;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public class Stylesheet implements RulesetContainer {
*/
private final int _origin;

private final List<FontFaceRule> _fontFaceRules = new ArrayList<FontFaceRule>();
private final List<StylesheetInfo> _importRules = new ArrayList<StylesheetInfo>();
private final List<FontFaceRule> _fontFaceRules = new ArrayList<>();
private final List<StylesheetInfo> _importRules = new ArrayList<>();

/**
* May contain page rules, media rules or rulesets.
*/
private final List<Object> _contents = new ArrayList<Object>();
private final List<Object> _contents = new ArrayList<>();

/**
* Creates a new instance of Stylesheet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class StylesheetInfo {
private String uri;
private int origin = USER_AGENT;
private String type;
private List<String> mediaTypes = new ArrayList<String>();
private List<String> mediaTypes = new ArrayList<>();
private String content;

/** Origin of stylesheet - user agent */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Specifically, the {@link #get(String, Callable)} may call the loader multiple times if called in close succession.
*/
public class FSDefaultCacheStore implements FSCacheEx<String, FSCacheValue> {
private final Map<String, FSCacheValue> _store = new ConcurrentHashMap<String, FSCacheValue>();
private final Map<String, FSCacheValue> _store = new ConcurrentHashMap<>();

@Override
public void put(String key, FSCacheValue value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public FloatManager(Box master) {

private List<BoxOffset> getAddableFloats(int direction) {
if (getFloats(direction).isEmpty()) {
setFloats(direction, new ArrayList<BoxOffset>());
setFloats(direction, new ArrayList<>());
}

return getFloats(direction);
Expand Down
Loading

0 comments on commit b98f5b8

Please sign in to comment.