Skip to content

Commit 9cedd42

Browse files
committed
downgrade to java 7 lang level
1 parent 3c510fa commit 9cedd42

165 files changed

Lines changed: 4922 additions & 1791 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.idea/compiler.xml

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 2089 additions & 791 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ than ideal and for pathological input either hangs or practically hangs during p
2020

2121
### Requirements
2222

23-
* Java 8 or above (to be downgraded to Java 7 in the next release)
23+
* Java 7 or above
2424
* The core has no dependencies; for extensions, see below
2525

2626
[![Build status](https://travis-ci.org/vsch/flexmark-java.svg?branch=master)](https://travis-ci.org/vsch/flexmark-java)
@@ -30,9 +30,9 @@ than ideal and for pathological input either hangs or practically hangs during p
3030
### Changes from commonmark-java project
3131

3232
- The project is on Maven: `com.vladsch.flexmark`
33-
- Java compatibility raised to 1.8 so that lambda syntax could be used during early development
33+
- Java compatibility raised to 1.7
3434
but will removed in the next release to support android compatibility
35-
- Android compatibility to be added once Java 8 requirement is removed
35+
- Android compatibility to be added
3636
- No attempt is made to keep API backward compatibility to the original project.
3737

3838
The API has stabilized but some changes may be necessary before 1.0 release.

VERSION.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ flexmark-java
6060
This Release To Do List
6161
-----------------------
6262

63-
- [ ] Change: remove Java 8 language constructs and reduce language level to 7 for android
64-
support.
65-
6663
- [ ] Change: Extensions wiki from table format for options to list, easier to maintain and read
6764
when descriptions can benefit form complex formatting
6865

@@ -101,6 +98,8 @@ Next Release To Do List
10198
0.7.1
10299
-----
103100

101+
- Change: remove Java 8 language constructs and reduce language level to 7 for android support.
102+
104103
- Change: remove `Substring` class from sequences and rename `StringSequence` to
105104
`StringBasedSequence`. `Substring` was duplicating code and not used except in tests.
106105

flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/AbbreviationExtension.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
import com.vladsch.flexmark.ext.abbreviation.internal.AbbreviationParagraphPreProcessor;
77
import com.vladsch.flexmark.ext.abbreviation.internal.AbbreviationRepository;
88
import com.vladsch.flexmark.html.HtmlRenderer;
9+
import com.vladsch.flexmark.html.renderer.NodeRenderer;
10+
import com.vladsch.flexmark.html.renderer.NodeRendererFactory;
911
import com.vladsch.flexmark.parser.Parser;
1012
import com.vladsch.flexmark.util.KeepType;
13+
import com.vladsch.flexmark.util.collection.DataValueFactory;
14+
import com.vladsch.flexmark.util.options.DataHolder;
1115
import com.vladsch.flexmark.util.options.DataKey;
1216

1317
/**
@@ -25,7 +29,12 @@ public class AbbreviationExtension implements Parser.ParserExtension, HtmlRender
2529
/**
2630
* A {@link DataKey} that is used to get the document's Node repository holding all the abbreviations defined in the current document.
2731
*/
28-
public static final DataKey<AbbreviationRepository> ABBREVIATIONS = new DataKey<>("ABBREVIATIONS", AbbreviationRepository::new);
32+
public static final DataKey<AbbreviationRepository> ABBREVIATIONS = new DataKey<>("ABBREVIATIONS", new DataValueFactory<AbbreviationRepository>() {
33+
@Override
34+
public AbbreviationRepository create(DataHolder options) {
35+
return new AbbreviationRepository(options);
36+
}
37+
});
2938

3039
/**
3140
* A {@link DataKey} that is used to set the behavior of the abbreviations repository when duplicates are defined. {@link KeepType}
@@ -51,6 +60,11 @@ public void extend(Parser.Builder parserBuilder) {
5160

5261
@Override
5362
public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) {
54-
if (rendererType.equals("HTML")) rendererBuilder.nodeRendererFactory(AbbreviationNodeRenderer::new);
63+
if (rendererType.equals("HTML")) rendererBuilder.nodeRendererFactory(new NodeRendererFactory() {
64+
@Override
65+
public NodeRenderer create(DataHolder options) {
66+
return new AbbreviationNodeRenderer(options);
67+
}
68+
});
5569
}
5670
}

flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/AbbreviationVisitor.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@
1515

1616
package com.vladsch.flexmark.ext.abbreviation;
1717

18-
import com.vladsch.flexmark.ast.VisitHandler;
19-
2018
public interface AbbreviationVisitor {
21-
static <V extends AbbreviationVisitor> VisitHandler<?>[] VISIT_HANDLERS(V visitor) {
22-
return new VisitHandler<?>[] {
23-
new VisitHandler<>(AbbreviationBlock.class, visitor::visit),
24-
new VisitHandler<>(Abbreviation.class, visitor::visit),
25-
};
26-
}
27-
2819
void visit(final AbbreviationBlock node);
2920
void visit(final Abbreviation node);
3021
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.vladsch.flexmark.ext.abbreviation;
2+
3+
import com.vladsch.flexmark.ast.VisitHandler;
4+
import com.vladsch.flexmark.ast.Visitor;
5+
6+
public class AbbreviationVisitorExt {
7+
static <V extends AbbreviationVisitor> VisitHandler<?>[] VISIT_HANDLERS(final V visitor) {
8+
return new VisitHandler<?>[] {
9+
new VisitHandler<>(AbbreviationBlock.class, new Visitor<AbbreviationBlock>() {
10+
@Override
11+
public void visit(AbbreviationBlock node) {
12+
visitor.visit(node);
13+
}
14+
}),
15+
new VisitHandler<>(Abbreviation.class, new Visitor<Abbreviation>() {
16+
@Override
17+
public void visit(Abbreviation node) {
18+
visitor.visit(node);
19+
}
20+
}),
21+
};
22+
}
23+
}

flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/internal/AbbreviationNodePostProcessor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.vladsch.flexmark.ext.abbreviation.AbbreviationBlock;
66
import com.vladsch.flexmark.ext.abbreviation.AbbreviationExtension;
77
import com.vladsch.flexmark.ext.autolink.internal.AutolinkNodePostProcessor;
8+
import com.vladsch.flexmark.html.renderer.NodeRenderingHandler;
89
import com.vladsch.flexmark.parser.PostProcessorFactory;
910
import com.vladsch.flexmark.parser.block.NodePostProcessor;
1011
import com.vladsch.flexmark.parser.block.NodePostProcessorFactory;
@@ -15,6 +16,7 @@
1516

1617
import java.util.Collections;
1718
import java.util.HashMap;
19+
import java.util.HashSet;
1820
import java.util.Set;
1921
import java.util.regex.Matcher;
2022
import java.util.regex.Pattern;
@@ -111,7 +113,9 @@ public void process(NodeTracker state, Node node) {
111113
public static class Factory extends NodePostProcessorFactory {
112114
@Override
113115
public Set<Class<? extends PostProcessorFactory>> getAfterDependents() {
114-
return Collections.singleton(AutolinkNodePostProcessor.Factory.class);
116+
HashSet<Class<? extends PostProcessorFactory>> set = new HashSet<>();
117+
set.add(AutolinkNodePostProcessor.Factory.class);
118+
return set;
115119
}
116120

117121
public Factory() {

flexmark-ext-abbreviation/src/main/java/com/vladsch/flexmark/ext/abbreviation/internal/AbbreviationNodeRenderer.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.vladsch.flexmark.ext.abbreviation.Abbreviation;
44
import com.vladsch.flexmark.ext.abbreviation.AbbreviationBlock;
5+
import com.vladsch.flexmark.html.CustomNodeRenderer;
56
import com.vladsch.flexmark.html.HtmlWriter;
67
import com.vladsch.flexmark.html.renderer.NodeRenderer;
78
import com.vladsch.flexmark.html.renderer.NodeRendererContext;
@@ -22,12 +23,21 @@ public AbbreviationNodeRenderer(DataHolder options) {
2223
@Override
2324
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
2425
return new HashSet<>(Arrays.asList(
25-
new NodeRenderingHandler<>(Abbreviation.class, this::render),
26-
new NodeRenderingHandler<>(AbbreviationBlock.class, this::render)
26+
new NodeRenderingHandler<>(Abbreviation.class, new CustomNodeRenderer<Abbreviation>() {
27+
@Override
28+
public void render(Abbreviation node, NodeRendererContext context, HtmlWriter html) {
29+
AbbreviationNodeRenderer.this.render(node, context, html);
30+
}
31+
}),
32+
new NodeRenderingHandler<>(AbbreviationBlock.class, new CustomNodeRenderer<AbbreviationBlock>() {
33+
@Override
34+
public void render(AbbreviationBlock node, NodeRendererContext context, HtmlWriter html) {
35+
AbbreviationNodeRenderer.this.render(node, context, html);
36+
}
37+
})
2738
));
2839
}
2940

30-
3141
private void render(AbbreviationBlock node, NodeRendererContext context, HtmlWriter html) {
3242

3343
}

0 commit comments

Comments
 (0)