Skip to content

Commit ed54236

Browse files
authored
Merge pull request #802 from eclipse-mylyn/575-remove-guava-from-wikitext-part-3
Remove last vestiges of guava #575
2 parents 26c69ac + 5094ac5 commit ed54236

File tree

17 files changed

+39
-64
lines changed

17 files changed

+39
-64
lines changed

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.asciidoc/META-INF/MANIFEST.MF

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Bundle-Name: Mylyn WikiText AsciiDoc
77
Bundle-Vendor: Eclipse Mylyn
88
Bundle-RequiredExecutionEnvironment: JavaSE-21
99
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=17))"
10-
Import-Package: com.google.common.base;version="[33.0,34.0)",
11-
org.apache.commons.lang3;version="[3.14.0,4.0.0)",
10+
Import-Package: org.apache.commons.lang3;version="[3.14.0,4.0.0)",
1211
org.eclipse.mylyn.wikitext.parser;version="[4.2,5)",
1312
org.eclipse.mylyn.wikitext.parser.builder;version="[4.2,5)",
1413
org.eclipse.mylyn.wikitext.parser.markup;version="[4.2,5)",

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.asciidoc/src/main/java/org/eclipse/mylyn/wikitext/asciidoc/internal/util/LanguageSupport.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import org.eclipse.mylyn.wikitext.asciidoc.internal.AsciiDocContentState;
2828
import org.eclipse.mylyn.wikitext.parser.TableCellAttributes;
2929

30-
import com.google.common.base.Splitter;
31-
3230
/**
3331
* Internal class to provide package internal support to the language
3432
*/
@@ -39,6 +37,8 @@ public class LanguageSupport {
3937

4038
private static Pattern keyValuePattern = Pattern.compile("(.*)=\"(.*)\""); //$NON-NLS-1$
4139

40+
private static final Pattern SPLIT_PATTERN = Pattern.compile(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"); //$NON-NLS-1$
41+
4242
/**
4343
* Helper method for parsing AsciiDoc format string (
4444
*
@@ -63,9 +63,7 @@ public static Map<String, String> parseFormattingProperties(String rawFormat, Li
6363
return properties;
6464
}
6565

66-
// TODO: handle escaped strings and default sequence of parameters
67-
// i.e. sunset,100,200,title="test"
68-
Iterable<String> valpairs = Splitter.on(Pattern.compile(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)")).split(rawFormat); //$NON-NLS-1$
66+
String[] valpairs = SPLIT_PATTERN.split(rawFormat);
6967
for (String pair : valpairs) {
7068
Matcher matcher = keyValuePattern.matcher(pair.trim());
7169

@@ -153,4 +151,4 @@ public static int computeHeadingLevel(int initialLevel, AsciiDocContentState sta
153151
return Math.max(1, Math.min(initialLevel + levelOffset, 6));
154152
}
155153

156-
}
154+
}

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.confluence/META-INF/MANIFEST.MF

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Bundle-Name: Mylyn WikiText Confluence
77
Bundle-Vendor: Eclipse Mylyn
88
Bundle-RequiredExecutionEnvironment: JavaSE-21
99
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=17))"
10-
Import-Package: com.google.common.base;version="[33.0,34.0)",
11-
org.apache.commons.lang3;version="[3.14.0,4.0.0)",
10+
Import-Package: org.apache.commons.lang3;version="[3.14.0,4.0.0)",
1211
org.eclipse.mylyn.wikitext.confluence,
1312
org.eclipse.mylyn.wikitext.confluence.internal,
1413
org.eclipse.mylyn.wikitext.confluence.internal.block,

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.confluence/src/main/java/org/eclipse/mylyn/wikitext/confluence/internal/ConfluenceDocumentBuilder.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
import org.eclipse.mylyn.wikitext.parser.builder.AbstractMarkupDocumentBuilder;
3636
import org.eclipse.mylyn.wikitext.parser.builder.EntityReferences;
3737

38-
import com.google.common.base.CharMatcher;
39-
4038
/**
4139
* a document builder that emits Confluence markup
4240
*
@@ -52,7 +50,7 @@ public class ConfluenceDocumentBuilder extends AbstractMarkupDocumentBuilder {
5250
private static final Pattern PATTERN_MULTIPLE_NEWLINES = Pattern
5351
.compile("(" + NEWLINE_REGEX + "(?:\\s+" + NEWLINE_REGEX + "|" + NEWLINE_REGEX + ")+)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
5452

55-
private static final CharMatcher SPAN_MARKUP_CHARACTERS = CharMatcher.anyOf("*_+-^~{}[]?%@"); //$NON-NLS-1$
53+
private static final String SPAN_MARKUP_CHARACTERS = "*_+-^~{}[]?%@"; //$NON-NLS-1$
5654

5755
private final Map<String, String> entityToLiteral = new HashMap<>();
5856

@@ -200,7 +198,7 @@ public final void close() throws IOException {
200198

201199
emitPrefix();
202200
if (trimmingNewlinesAndWhitespace) {
203-
content = CharMatcher.whitespace().trimFrom(content);
201+
content = content.strip();
204202
}
205203
if (collapsingConsecutiveNewlines) {
206204
content = PATTERN_MULTIPLE_NEWLINES.matcher(content).replaceAll("\n"); //$NON-NLS-1$
@@ -464,7 +462,7 @@ private boolean isEscapeCharacter(int i) {
464462
}
465463

466464
private boolean isSpanMarkup(char character) {
467-
return SPAN_MARKUP_CHARACTERS.matches(character);
465+
return SPAN_MARKUP_CHARACTERS.indexOf(character) >= 0;
468466
}
469467

470468
@Override
@@ -631,4 +629,4 @@ private void writeImageAttributes(Attributes attributes) throws IOException {
631629
}
632630
}
633631
}
634-
}
632+
}

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.confluence/src/main/java/org/eclipse/mylyn/wikitext/confluence/internal/block/TableBlock.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import org.eclipse.mylyn.wikitext.parser.DocumentBuilder.BlockType;
2323
import org.eclipse.mylyn.wikitext.parser.markup.Block;
2424

25-
import com.google.common.base.CharMatcher;
26-
2725
/**
2826
* Table block, matches blocks that start with <code>table. </code> or those that start with a table row.
2927
*
@@ -161,7 +159,7 @@ private boolean isNestableCellContent(String cellContent) {
161159

162160
private void emitMarkup(String text, int lineOffset) {
163161
getConfluenceLanguage().emitMarkupLine(getParser(), state, lineOffset,
164-
CharMatcher.whitespace().trimTrailingFrom(text), 0);
162+
text.replaceAll("\\s+$", ""), 0);
165163
}
166164

167165
private ConfluenceLanguage getConfluenceLanguage() {
@@ -240,4 +238,4 @@ private void ensureCellClosed() {
240238
multiLineCell = false;
241239
}
242240
}
243-
}
241+
}

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.html/META-INF/MANIFEST.MF

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ Bundle-Name: Mylyn WikiText HTML
99
Bundle-Vendor: Eclipse Mylyn
1010
Bundle-RequiredExecutionEnvironment: JavaSE-21
1111
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=17))"
12-
Import-Package: com.google.common.base;version="[33.0,34.0)",
13-
org.apache.commons.lang3;version="[3.14.0,4.0.0)",
12+
Import-Package: org.apache.commons.lang3;version="[3.14.0,4.0.0)",
1413
org.eclipse.mylyn.wikitext.parser;version="[4.2,5)",
1514
org.eclipse.mylyn.wikitext.parser.builder;version="[4.2,5)",
1615
org.eclipse.mylyn.wikitext.parser.css;version="[4.2,5)",

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.html/src/main/java/org/eclipse/mylyn/wikitext/html/internal/SpanStrategies.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
import org.eclipse.mylyn.wikitext.parser.css.CssParser;
3030
import org.eclipse.mylyn.wikitext.parser.css.CssRule;
3131

32-
import com.google.common.base.CharMatcher;
33-
import com.google.common.base.Splitter;
34-
3532
public class SpanStrategies extends ElementStrategies<SpanType, SpanStrategy, SpanHtmlElementStrategy> {
3633

3734
private static final Map<SpanType, List<SpanType>> spanTypeToAlternatives = createSpanTypeToAlternatives();
@@ -131,8 +128,9 @@ private SpanStrategy calculateAlternateSpanStrategy(Attributes attributes) {
131128
}
132129

133130
private boolean isFontFamilyMonospace(CssRule rule) {
134-
for (String value : Splitter.on(',').trimResults(CharMatcher.whitespace()).split(rule.value)) {
135-
if ("monospace".equalsIgnoreCase(value)) { //$NON-NLS-1$
131+
for (String value : rule.value.split(",")) { //$NON-NLS-1$
132+
String trimmed = value.trim();
133+
if ("monospace".equalsIgnoreCase(trimmed)) { //$NON-NLS-1$
136134
return true;
137135
}
138136
}
@@ -148,4 +146,4 @@ private SpanStrategy calculateAlternateSpanStrategy(SpanType spanType) {
148146
}
149147
return null;
150148
}
151-
}
149+
}

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.maven/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@
6565
<version>3.4</version>
6666
<scope>test</scope>
6767
</dependency>
68-
<dependency>
69-
<groupId>com.google.guava</groupId>
70-
<artifactId>guava</artifactId>
71-
<version>${guava.version}</version>
72-
</dependency>
7368
<dependency>
7469
<groupId>org.apache.commons</groupId>
7570
<artifactId>commons-lang3</artifactId>

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.textile.tests/META-INF/MANIFEST.MF

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ Bundle-Vendor: Eclipse Mylyn
88
Fragment-Host: org.eclipse.mylyn.wikitext.textile
99
Bundle-RequiredExecutionEnvironment: JavaSE-21
1010
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=17))"
11-
Import-Package: com.google.common.base;version="[33.0,34.0)",
12-
org.eclipse.mylyn.wikitext.parser;version="[4.2,5)",
11+
Import-Package: org.eclipse.mylyn.wikitext.parser;version="[4.2,5)",
1312
org.eclipse.mylyn.wikitext.parser.builder;version="[4.2,5)",
1413
org.eclipse.mylyn.wikitext.parser.markup;version="[4.2,5)",
1514
org.eclipse.mylyn.wikitext.parser.markup.block;version="[4.2,5)",

mylyn.docs/wikitext/core/org.eclipse.mylyn.wikitext.textile.tests/src/test/java/org/eclipse/mylyn/wikitext/textile/internal/tests/TextileDocumentBuilderEntityReferenceTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import org.eclipse.mylyn.wikitext.textile.internal.TextileDocumentBuilder;
2222
import org.junit.Test;
2323

24-
import com.google.common.base.CharMatcher;
25-
2624
@SuppressWarnings({ "nls", "restriction" })
2725
public class TextileDocumentBuilderEntityReferenceTest {
2826

@@ -80,7 +78,7 @@ private void assertCharacter(String expected, String character) {
8078
builder.endDocument();
8179

8280
String markup = out.toString();
83-
String expectedSequence = CharMatcher.whitespace().trimAndCollapseFrom("a " + expected + " test", ' ');
81+
String expectedSequence = collapseAndTrimWhitespace("a " + expected + " test");
8482
assertEquals(expectedSequence + "\n\n", markup);
8583
}
8684

@@ -95,4 +93,8 @@ private void assertEntityReference(String expected, String entity) {
9593
assertEquals(expected + "\n\n", markup);
9694
}
9795

98-
}
96+
private static String collapseAndTrimWhitespace(String input) {
97+
return input.strip().replaceAll("\\s+", " ");
98+
}
99+
100+
}

0 commit comments

Comments
 (0)