Skip to content

Commit

Permalink
Less guava usage
Browse files Browse the repository at this point in the history
Easily replaced with standard Java API
  • Loading branch information
akurtakov committed Jan 17, 2023
1 parent 409a08f commit 4fd84e3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013, 2021 Tasktop Technologies and others.
* Copyright (c) 2013, 2023 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -24,8 +24,6 @@

import org.eclipse.mylyn.wikitext.parser.DocumentBuilder.BlockType;

import com.google.common.collect.ImmutableList;

class BlockStrategies extends ElementStrategies<BlockType, BlockStrategy, HtmlElementStrategy<BlockType>> {

private static final Map<BlockType, List<BlockType>> blockTypeToAlternatives = createBlockTypeToAlternatives();
Expand Down Expand Up @@ -58,7 +56,7 @@ private static void addAlternatives(Map<BlockType, List<BlockType>> alternatives
BlockType... blockTypes) {
checkState(!alternatives.containsKey(blockType), "Duplicate %s", blockType); //$NON-NLS-1$
checkArgument(blockTypes.length > 0);
alternatives.put(blockType, ImmutableList.copyOf(blockTypes));
alternatives.put(blockType, List.of(blockTypes));
}

BlockStrategies(Set<BlockType> blockTypes) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013, 2021 Tasktop Technologies and others.
* Copyright (c) 2013, 2023 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -32,7 +32,6 @@

import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;

public class SpanStrategies extends ElementStrategies<SpanType, SpanStrategy, SpanHtmlElementStrategy> {

Expand All @@ -54,7 +53,7 @@ private static void addAlternatives(Map<SpanType, List<SpanType>> alternatives,
SpanType... spanTypes) {
checkState(!alternatives.containsKey(spanType), "Duplicate %s", spanType); //$NON-NLS-1$
checkArgument(spanTypes.length > 0);
alternatives.put(spanType, ImmutableList.copyOf(spanTypes));
alternatives.put(spanType, List.of(spanTypes));
}

SpanStrategies(Set<SpanType> elementTypes, List<SpanHtmlElementStrategy> spanElementStrategies) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2012 David Green and others.
* Copyright (c) 2007, 2023 David Green and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -20,8 +20,6 @@
import org.eclipse.mylyn.wikitext.parser.markup.PatternBasedElement;
import org.eclipse.mylyn.wikitext.parser.markup.PatternBasedElementProcessor;

import com.google.common.collect.ImmutableList;

/**
* @author David Green
*/
Expand All @@ -35,7 +33,7 @@ private static class SimplePhraseModifierProcessor extends PatternBasedElementPr
private final boolean nesting;

public SimplePhraseModifierProcessor(SpanType[] spanType, boolean nesting) {
this.spanType = ImmutableList.copyOf(spanType);
this.spanType = List.of(spanType);
this.nesting = nesting;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2014 David Green and others.
* Copyright (c) 2007, 2023 David Green and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -32,8 +32,6 @@
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import com.google.common.collect.ImmutableList;

public class HtmlParserTest {
static class EndEvent {

Expand Down Expand Up @@ -239,7 +237,7 @@ public void endSpan() {
}
};
parse(content, builder);
assertEquals(ImmutableList.copyOf(expectedEventTypes), actualEventTypes);
assertEquals(List.of(expectedEventTypes), actualEventTypes);
}

@Test
Expand Down

0 comments on commit 4fd84e3

Please sign in to comment.