Skip to content

Commit fb51588

Browse files
committed
started 2.2.0-SNAPSHOT, minimal Java lifted up to 11
1 parent a4e3438 commit fb51588

File tree

8 files changed

+69
-99
lines changed

8 files changed

+69
-99
lines changed

pom.xml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.igormaznitsa</groupId>
66
<artifactId>java-prolog-parser</artifactId>
7-
<version>2.1.0</version>
7+
<version>2.2.0-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<name>Edinburgh Prolog parser</name>
@@ -65,31 +65,31 @@
6565
<dependency>
6666
<groupId>org.junit.jupiter</groupId>
6767
<artifactId>junit-jupiter-api</artifactId>
68-
<version>5.10.1</version>
68+
<version>5.11.4</version>
6969
<scope>test</scope>
7070
</dependency>
7171
<dependency>
7272
<groupId>org.junit.jupiter</groupId>
7373
<artifactId>junit-jupiter-engine</artifactId>
74-
<version>5.10.1</version>
74+
<version>5.11.4</version>
7575
<scope>test</scope>
7676
</dependency>
7777
<dependency>
7878
<groupId>net.bytebuddy</groupId>
7979
<artifactId>byte-buddy-agent</artifactId>
80-
<version>1.14.10</version>
80+
<version>1.14.15</version>
8181
<scope>test</scope>
8282
</dependency>
8383
<dependency>
8484
<groupId>net.bytebuddy</groupId>
8585
<artifactId>byte-buddy</artifactId>
86-
<version>1.14.10</version>
86+
<version>1.14.15</version>
8787
<scope>test</scope>
8888
</dependency>
8989
<dependency>
9090
<groupId>org.mockito</groupId>
9191
<artifactId>mockito-core</artifactId>
92-
<version>5.7.0</version>
92+
<version>5.12.0</version>
9393
<scope>test</scope>
9494
<exclusions>
9595
<exclusion>
@@ -112,7 +112,7 @@
112112
<plugin>
113113
<groupId>org.apache.maven.plugins</groupId>
114114
<artifactId>maven-assembly-plugin</artifactId>
115-
<version>3.6.0</version>
115+
<version>3.7.1</version>
116116
<configuration>
117117
<descriptors>
118118
<descriptor>src/assemble/distribution.xml</descriptor>
@@ -149,7 +149,7 @@
149149
<plugin>
150150
<groupId>org.apache.maven.plugins</groupId>
151151
<artifactId>maven-source-plugin</artifactId>
152-
<version>3.3.0</version>
152+
<version>3.3.1</version>
153153
<executions>
154154
<execution>
155155
<id>generate-sources</id>
@@ -163,7 +163,7 @@
163163
<plugin>
164164
<groupId>org.apache.maven.plugins</groupId>
165165
<artifactId>maven-javadoc-plugin</artifactId>
166-
<version>3.5.0</version>
166+
<version>3.8.0</version>
167167
<configuration>
168168
<failOnError>true</failOnError>
169169
<show>protected</show>
@@ -183,7 +183,7 @@
183183
<plugin>
184184
<groupId>org.apache.maven.plugins</groupId>
185185
<artifactId>maven-gpg-plugin</artifactId>
186-
<version>3.1.0</version>
186+
<version>3.2.7</version>
187187
<executions>
188188
<execution>
189189
<id>sign-artifacts</id>
@@ -203,16 +203,17 @@
203203
<plugins>
204204
<plugin>
205205
<artifactId>maven-resources-plugin</artifactId>
206-
<version>3.3.0</version>
206+
<version>3.3.1</version>
207207
</plugin>
208208
<plugin>
209209
<groupId>org.apache.maven.plugins</groupId>
210210
<artifactId>maven-compiler-plugin</artifactId>
211-
<version>3.11.0</version>
211+
<version>3.13.0</version>
212212
<configuration>
213213
<compilerArgument>-Xlint:all</compilerArgument>
214-
<source>1.8</source>
215-
<target>1.8</target>
214+
<source>11</source>
215+
<target>11</target>
216+
<release>11</release>
216217
<showDeprecation>true</showDeprecation>
217218
<showWarnings>true</showWarnings>
218219
</configuration>
@@ -221,7 +222,7 @@
221222
<plugin>
222223
<groupId>org.apache.maven.plugins</groupId>
223224
<artifactId>maven-jar-plugin</artifactId>
224-
<version>3.3.0</version>
225+
<version>3.4.1</version>
225226
<configuration>
226227
<archive>
227228
<manifestEntries>
@@ -233,26 +234,29 @@
233234

234235
<plugin>
235236
<artifactId>maven-surefire-plugin</artifactId>
236-
<version>3.2.2</version>
237+
<version>3.5.2</version>
237238
</plugin>
238239

239240
<plugin>
240241
<groupId>org.codehaus.mojo</groupId>
241242
<artifactId>animal-sniffer-maven-plugin</artifactId>
242-
<version>1.23</version>
243+
<version>1.24</version>
243244
<executions>
244245
<execution>
245-
<id>ensure-java-1.8-class-library</id>
246+
<id>ensure-android-api-compatibility</id>
246247
<phase>test</phase>
247248
<goals>
248249
<goal>check</goal>
249250
</goals>
250251
<configuration>
251252
<signature>
252-
<groupId>org.codehaus.mojo.signature</groupId>
253-
<artifactId>java18</artifactId>
254-
<version>1.0</version>
253+
<groupId>com.toasttab.android</groupId>
254+
<artifactId>gummy-bears-api-32</artifactId>
255+
<version>0.10.0</version>
255256
</signature>
257+
<ignores>
258+
<ignore>java.lang.invoke.*</ignore>
259+
</ignores>
256260
</configuration>
257261
</execution>
258262
</executions>

src/main/java/com/igormaznitsa/prologparser/PrologParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
634634

635635
@Override
636636
public Iterator<PrologTerm> iterator() {
637-
return new Iterator<PrologTerm>() {
637+
return new Iterator<>() {
638638
@Override
639639
public boolean hasNext() {
640640
return PrologParser.this.hasNext();

src/main/java/com/igormaznitsa/prologparser/terms/PrologList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public Iterator<PrologTerm> iterator() {
287287
if (this.isEmpty()) {
288288
return Collections.emptyIterator();
289289
} else {
290-
return new Iterator<PrologTerm>() {
290+
return new Iterator<>() {
291291

292292
private PrologTerm head = elements[0];
293293
private PrologTerm tail = elements[1];

src/main/java/com/igormaznitsa/prologparser/terms/PrologStruct.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public Stream<PrologTerm> stream() {
365365

366366
@Override
367367
public Iterator<PrologTerm> iterator() {
368-
return new Iterator<PrologTerm>() {
368+
return new Iterator<>() {
369369
final PrologTerm[] terms = elements.clone();
370370
int index = 0;
371371

src/main/java/com/igormaznitsa/prologparser/terms/Quotation.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
import static com.igormaznitsa.prologparser.utils.StringUtils.escapeString;
2525

26+
import java.util.List;
27+
2628
/**
2729
* Type of quotation for prolog term.
2830
*/
@@ -48,6 +50,7 @@ public enum Quotation {
4850
BACK_TICK("`");
4951

5052
private final String quotationMark;
53+
public static final List<Quotation> VALUES = List.of(Quotation.values());
5154

5255
Quotation(final String quotationMark) {
5356
this.quotationMark = quotationMark;

src/main/java/com/igormaznitsa/prologparser/terms/TermType.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.igormaznitsa.prologparser.terms;
2323

24+
import java.util.List;
25+
2426
/**
2527
* Type of prolog term.
2628
*/
@@ -44,5 +46,8 @@ public enum TermType {
4446
/**
4547
* Operator term.
4648
*/
47-
OPERATOR
49+
OPERATOR;
50+
51+
public static final List<TermType> VALUES = List.of(TermType.values());
52+
4853
}

src/main/java/com/igormaznitsa/prologparser/tokenizer/Op.java

Lines changed: 29 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -89,106 +89,64 @@ public final class Op extends PrologTerm {
8989
/**
9090
* Set of operators specific for Sictus Prolog.
9191
*/
92-
public static final List<Op> SICTUS_SPECIFIC = Collections.unmodifiableList(Arrays.asList(
93-
MODIFIERS,
94-
make(1150, FX, "mode", "block", "meta_predicate"),
95-
make(1100, XFY, "do"),
96-
make(900, FY, "spy", "nospy"),
97-
make(550, XFY, ":"),
98-
make(500, YFX, "\\"),
99-
GNU_UNARY_PLUS
100-
));
92+
public static final List<Op> SICTUS_SPECIFIC =
93+
List.of(MODIFIERS, make(1150, FX, "mode", "block", "meta_predicate"), make(1100, XFY, "do"),
94+
make(900, FY, "spy", "nospy"), make(550, XFY, ":"), make(500, YFX, "\\"), GNU_UNARY_PLUS);
10195
public static final Op GNU_DIV_RDIV = make(400, OpAssoc.YFX, "div", "rdiv");
10296
public static final Op ISO_OR = make(1100, OpAssoc.XFY, ";");
10397
public static final Op ISO_THEN = make(1050, OpAssoc.XFY, "->");
10498
/**
10599
* Set of operators for ISO Prolog standard.
106100
*/
107-
public static final List<Op> ISO = Collections.unmodifiableList(Arrays.asList(
108-
ISO_CLAUSES,
109-
ISO_DIRECTIVES,
110-
ISO_OR,
111-
ISO_THEN,
112-
ISO_NEGATE,
113-
ISO_UNIFICATION,
114-
ISO_ORDER_ARITH,
115-
ISO_ORDER_TERM,
116-
ISO_ARITH_PLUS_MINUS,
117-
ISO_BITWISE_AND_OR,
118-
ISO_ARITH_MUL_DIV,
119-
ISO_BITWISE_SHIFT,
120-
ISO_ARITH_DIVIDE,
121-
ISO_ARITH_POWER,
122-
make(200, OpAssoc.XFY, "^"),
123-
ISO_UNARY_MINUS,
124-
ISO_BITWISE_NEGATION,
125-
make(100, OpAssoc.XFX, "@")
126-
));
101+
public static final List<Op> ISO =
102+
List.of(ISO_CLAUSES, ISO_DIRECTIVES, ISO_OR, ISO_THEN, ISO_NEGATE, ISO_UNIFICATION,
103+
ISO_ORDER_ARITH, ISO_ORDER_TERM, ISO_ARITH_PLUS_MINUS, ISO_BITWISE_AND_OR,
104+
ISO_ARITH_MUL_DIV, ISO_BITWISE_SHIFT, ISO_ARITH_DIVIDE, ISO_ARITH_POWER,
105+
make(200, OpAssoc.XFY, "^"), ISO_UNARY_MINUS, ISO_BITWISE_NEGATION,
106+
make(100, OpAssoc.XFX, "@"));
127107
public static final Op GNU_STAR_THEN = make(1050, OpAssoc.XFY, "*->");
128108
public static final Op GNU_DOUBLE_DOT = make(600, OpAssoc.XFY, ":");
129109
/**
130110
* Set of operators is specific for GNU Prolog use.
131111
*/
132-
public static final List<Op> GNU_SPECIFIC = Collections.unmodifiableList(Arrays.asList(
133-
GNU_STAR_THEN,
134-
GNU_DOUBLE_DOT,
135-
GNU_DIV_RDIV,
136-
GNU_UNARY_PLUS
137-
));
112+
public static final List<Op> GNU_SPECIFIC =
113+
List.of(GNU_STAR_THEN, GNU_DOUBLE_DOT, GNU_DIV_RDIV, GNU_UNARY_PLUS);
138114
/**
139115
* Set of operators for GNU Prolog.
140116
*/
141117
public static final List<Op> GNU = Collections.unmodifiableList(Op.join(ISO, GNU_SPECIFIC));
142118
/**
143119
* Set of operators is specific for SWI Prolog use.
144120
*/
145-
public static final List<Op> SWI_SPECIFIC = Collections.unmodifiableList(Arrays.asList(
146-
MODIFIERS,
121+
public static final List<Op> SWI_SPECIFIC = List.of(MODIFIERS,
147122
make(1150, OpAssoc.FX, "meta_predicate", "module_transparent", "thread_local",
148-
"thread_initialization"),
149-
GNU_STAR_THEN,
150-
make(990, OpAssoc.FY, ":="),
151-
make(700, OpAssoc.XFX, "=@=", "\\=@=", "as", ">:<", ":<"),
152-
GNU_DOUBLE_DOT,
153-
make(500, OpAssoc.YFX, "xor"),
154-
make(500, OpAssoc.FX, "?"),
155-
GNU_DIV_RDIV,
156-
GNU_UNARY_PLUS,
157-
make(1, OpAssoc.FX, "$")
158-
));
123+
"thread_initialization"), GNU_STAR_THEN, make(990, OpAssoc.FY, ":="),
124+
make(700, OpAssoc.XFX, "=@=", "\\=@=", "as", ">:<", ":<"), GNU_DOUBLE_DOT,
125+
make(500, OpAssoc.YFX, "xor"), make(500, OpAssoc.FX, "?"), GNU_DIV_RDIV, GNU_UNARY_PLUS,
126+
make(1, OpAssoc.FX, "$"));
159127
/**
160128
* Set of operators for SWI Prolog.
161129
*/
162130
public static final List<Op> SWI = Collections.unmodifiableList(Op.join(ISO, SWI_SPECIFIC));
163131
/**
164132
* Set of Finite Domain operators for GNU Prolog.
165133
*/
166-
public static final List<Op> GNU_FD = Collections.unmodifiableList(Arrays.asList(
167-
make(750, XFY, "#<=>", "#\\<=>"),
168-
make(740, XFY, "#==>", "#\\==>"),
169-
make(730, XFY, "##"),
170-
make(730, YFX, "#\\/", "#\\\\/"),
171-
make(720, YFX, "#/\\", "#\\/\\"),
172-
make(710, FY, "#\\"),
173-
make(700, XFX, "#=", "#\\=", "#<", "#=<", "#>", "#>=", "#=#", "#\\=#", "#<#", "#=<#", "#>#",
174-
"#>=#")
175-
));
134+
public static final List<Op> GNU_FD =
135+
List.of(make(750, XFY, "#<=>", "#\\<=>"), make(740, XFY, "#==>", "#\\==>"),
136+
make(730, XFY, "##"), make(730, YFX, "#\\/", "#\\\\/"), make(720, YFX, "#/\\", "#\\/\\"),
137+
make(710, FY, "#\\"),
138+
make(700, XFX, "#=", "#\\=", "#<", "#=<", "#>", "#>=", "#=#", "#\\=#", "#<#", "#=<#",
139+
"#>#",
140+
"#>=#"));
176141
/**
177142
* Set of Constraint Logic Programming operators for SWI Prolog.
178143
*/
179-
public static final List<Op> SWI_CPL = Collections.unmodifiableList(Arrays.asList(
180-
make(300, FY, "~"),
181-
make(500, YFX, "#"),
182-
make(760, YFX, "#<==>"),
183-
make(750, XFY, "#==>"),
184-
make(750, YFX, "#<=="),
185-
make(740, YFX, "#\\/"),
186-
make(730, YFX, "#\\"),
187-
make(720, YFX, "#/\\"),
188-
make(710, FY, "#\\"),
189-
make(700, XFX, "#>", "#<", "#>=", "#=<", "#=", "#\\=", "in", "ins"),
190-
make(450, XFX, "..")
191-
));
144+
public static final List<Op> SWI_CPL =
145+
List.of(make(300, FY, "~"), make(500, YFX, "#"), make(760, YFX, "#<==>"),
146+
make(750, XFY, "#==>"), make(750, YFX, "#<=="), make(740, YFX, "#\\/"),
147+
make(730, YFX, "#\\"), make(720, YFX, "#/\\"), make(710, FY, "#\\"),
148+
make(700, XFX, "#>", "#<", "#>=", "#=<", "#=", "#\\=", "in", "ins"),
149+
make(450, XFX, ".."));
192150

193151
public static final Op VIRTUAL_OPERATOR_BLOCK = makeSystem(-1, OpAssoc.FX, "()");
194152
public static final Op VIRTUAL_OPERATOR_CURLY_BLOCK = makeSystem(-1, OpAssoc.FX, "{}");

src/main/java/com/igormaznitsa/prologparser/tokenizer/OpAssoc.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
package com.igormaznitsa.prologparser.tokenizer;
2323

24+
import java.util.List;
2425
import java.util.Optional;
25-
import java.util.stream.Stream;
2626

2727
/**
2828
* Associativity of Prolog operators.
@@ -59,8 +59,8 @@ public enum OpAssoc {
5959
*/
6060
YFX("yfx", 2);
6161

62+
public static final List<OpAssoc> VALUES = List.of(OpAssoc.values());
6263
private final String text;
63-
6464
private final int arity;
6565

6666
OpAssoc(final String text, final int arity) {
@@ -69,7 +69,7 @@ public enum OpAssoc {
6969
}
7070

7171
public static Optional<OpAssoc> findForName(final String str) {
72-
return Stream.of(values()).filter(x -> x.text.equals(str)).findFirst();
72+
return VALUES.stream().filter(x -> x.text.equals(str)).findFirst();
7373
}
7474

7575
public boolean isPostfix() {

0 commit comments

Comments
 (0)