diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 33f5082c..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-dist: trusty
-language: java
-jdk:
- - oraclejdk8
-cache:
- directories:
- - $HOME/.m2
-before_install:
- - git submodule update --init --recursive
diff --git a/LICENSE.txt b/LICENSE.txt
index a9c80ed1..ba3d5d28 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2016, Burt AB
+Copyright (c) 2016, Burt Intelligence AB and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
diff --git a/README.md b/README.md
index ccef4161..d543992c 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,30 @@
# jmespath-java
-[](https://travis-ci.org/burtcorp/jmespath-java)
+_If you're reading this on GitHub, please note that this is the readme for the development version and that some features described here might not yet have been released. You can find the readme for a specific version via the release tags ([here is an example](https://github.com/burtcorp/jmespath-java/releases/tag/jmespath-0.5.0))._
-_If you're reading this on GitHub, please note that this is the readme for the development version and that some features described here might not yet have been released. You can find the readme for a specific version via the release tags ([here is an example](https://github.com/burtcorp/jmespath-java/releases/tag/jmespath-0.1.0))._
-
-This is an implementation of [JMESPath](http://jmespath.org/) for Java and it supports searching JSON documents (via [Jackson](https://github.com/FasterXML/jackson) or [Gson](https://github.com/google/gson)) and structures containing basic Java objects (`Map`, `List`, `String`, etc.) – but can also be extended to work with any JSON-like structure.
+This is an implementation of [JMESPath](http://jmespath.org/) for Java. It supports multiple JSON libraries, for example [Jackson](https://github.com/FasterXML/jackson), [Jackson jr](https://github.com/FasterXML/jackson-jr), [Gson](https://github.com/google/gson), and structures containing basic Java objects (`Map`, `List`, `String`, etc.). It can be extended to support any JSON-like structure through a simple adapter.
## Installation
-Using Maven you can add this to your dependencies:
+You can install the library using Maven:
```xml
io.burt
- jmespath
+ ${jmespath.adapter}
${jmespath.version}
```
-Check the [releases page](https://github.com/burtcorp/jmespath-java/releases) for the value of `${jmespath.version}`.
+Replace `${jmespath.adapter}` with the adapter you need for your project, for example `jmespath-jackson` or `jmespath-gson`. You can also use `jmespath-core` if you are going to implement your own adapter in your project.
-If you don't want both the Jackson and Gson implementations you can change it to `jmespath-jackson` or `jmespath-gson`. Some time before 1.0 the dependencies will probably be reversed so that `jmespath` will not depend on the specific runtimes, so you unless you have the need for multiple runtimes you should depend on the specific runtime you need.
+Replace `${jmespath.version}` with the latest version from the [releases page](https://github.com/burtcorp/jmespath-java/releases).
### Dependencies
`jmespath-core` has an ANTLR based parser, but the ANTLR runtime artifact has been shaded into the `io.burt.jmespath` package to avoid conflicts with other artifacts that may depend on ANTLR. This means that `jmespath-core` has no external dependencies.
-`jmespath-jackson` obviously depends on Jackson, specifically Jackson DataBind (`com.fasterxml.jackson.core:jackson-databind`), but other than that it only depends on `jmespath-core`.
-
-`jmespath-gson` depends on Gson, specifically `com.google.code.gson:gson`, but other than that only `jmespath-core`.
+The adapters each depend on their supporting libraries, for example Jackson Databind for `jmespath-jackson`.
## Basic usage
@@ -59,7 +55,7 @@ JsonNode result = expression.search(input);
## Description
-`jmespath-java` comes in three parts: `jmespath-core`, `jmespath-jackson`, and `jmespath-gson`. The former contains the expression parser, core runtime, default functions and a simple runtime adapter that can search structures made up from numbers, strings, booleans, `List` and `Map` available as `io.burt.jmespath.jcf.JcfRuntime` (for "Java Collections Framework"). The latter contains the Jackson and Gson runtime adapters, respectively, and is what you should be using most of the time. The JCF runtime is just for internal development and testing. It primarily exists to test that there's nothing runtime-specific in the implementation.
+`jmespath-java` comes in multiple parts: `jmespath-core`, and the adapters for different JSON libraries, like `jmespath-jackson`, and `jmespath-gson`. `jmespath-core` contains the expression parser, core runtime, default functions and a simple runtime adapter that can search structures made up from numbers, strings, booleans, `List` and `Map` available as `io.burt.jmespath.jcf.JcfRuntime` (for "Java Collections Framework"). The latter contains runtime adapters for each specific JSON library, and is what you should be using most of the time. The JCF runtime is just for internal development and testing. It primarily exists to test that there's nothing runtime-specific in the implementation.
## Configuration
@@ -177,4 +173,4 @@ And all dependencies should be installed, the code compiled and the tests run.
# Copyright
-© 2016-2018 Burt AB, see LICENSE.txt (BSD 3-Clause).
+© 2016 Burt Intelligence AB and contributors, see LICENSE.txt (BSD 3-Clause).
diff --git a/jmespath-core/pom.xml b/jmespath-core/pom.xml
index 06de939f..ab003a94 100644
--- a/jmespath-core/pom.xml
+++ b/jmespath-core/pom.xml
@@ -10,9 +10,13 @@
io.burt
jmespath
- 0.5.1
+ 0.6.0
+
+ 4.9.3
+
+
org.antlr
diff --git a/jmespath-core/src/main/antlr4/io/burt/jmespath/parser/JmesPath.g4 b/jmespath-core/src/main/antlr4/io/burt/jmespath/parser/JmesPath.g4
index 8d6dc5f4..3188179c 100644
--- a/jmespath-core/src/main/antlr4/io/burt/jmespath/parser/JmesPath.g4
+++ b/jmespath-core/src/main/antlr4/io/burt/jmespath/parser/JmesPath.g4
@@ -6,8 +6,8 @@ expression
: expression '.' chainedExpression # chainExpression
| expression bracketSpecifier # bracketedExpression
| bracketSpecifier # bracketExpression
- | expression COMPARATOR expression # comparisonExpression
| '!' expression # notExpression
+ | expression COMPARATOR expression # comparisonExpression
| expression '&&' expression # andExpression
| expression '||' expression # orExpression
| identifier # identifierExpression
diff --git a/jmespath-core/src/main/java/io/burt/jmespath/node/NegateNode.java b/jmespath-core/src/main/java/io/burt/jmespath/node/NegateNode.java
index 1a628dfe..d1d083f4 100644
--- a/jmespath-core/src/main/java/io/burt/jmespath/node/NegateNode.java
+++ b/jmespath-core/src/main/java/io/burt/jmespath/node/NegateNode.java
@@ -22,6 +22,11 @@ protected boolean internalEquals(Object o) {
return negated.equals(other.negated);
}
+ @Override
+ protected String internalToString() {
+ return negated.toString();
+ }
+
@Override
protected int internalHashCode() {
return 17 + 31 * negated.hashCode();
diff --git a/jmespath-core/src/test/java/io/burt/jmespath/ComplianceRunner.java b/jmespath-core/src/test/java/io/burt/jmespath/ComplianceRunner.java
index 31277f9a..cdbf80e6 100644
--- a/jmespath-core/src/test/java/io/burt/jmespath/ComplianceRunner.java
+++ b/jmespath-core/src/test/java/io/burt/jmespath/ComplianceRunner.java
@@ -29,10 +29,8 @@ private Description createDescription(JmesPathComplianceTest.ComplianceTest c
private Collection> getAllTests() {
try {
return testClass.newInstance().getAllTests();
- } catch (InstantiationException ie) {
- throw new RuntimeException("Could not instantiate runtime", ie);
- } catch (IllegalAccessException iae) {
- throw new RuntimeException("Could not instantiate runtime", iae);
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new RuntimeException("Could not instantiate runtime", e);
}
}
@@ -42,9 +40,7 @@ public void run(RunNotifier notifier) {
notifier.fireTestStarted(testDescription);
try {
complianceTest.run();
- } catch (AssertionError ae) {
- notifier.fireTestFailure(new Failure(testDescription, ae));
- } catch (Exception e) {
+ } catch (AssertionError | Exception e) {
notifier.fireTestFailure(new Failure(testDescription, e));
} finally {
notifier.fireTestFinished(testDescription);
diff --git a/jmespath-core/src/test/java/io/burt/jmespath/JmesPathComplianceTest.java b/jmespath-core/src/test/java/io/burt/jmespath/JmesPathComplianceTest.java
index 5f6495d8..2050dc54 100644
--- a/jmespath-core/src/test/java/io/burt/jmespath/JmesPathComplianceTest.java
+++ b/jmespath-core/src/test/java/io/burt/jmespath/JmesPathComplianceTest.java
@@ -18,7 +18,7 @@
import org.junit.runner.RunWith;
import org.hamcrest.Matcher;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.hamcrest.Matchers.containsString;
@@ -72,9 +72,10 @@ public void run() {
Expression compiledExpression = runtime.compile(expression);
U result = compiledExpression.search(input);
if (expectedError == null) {
- assertTrue(
+ assertThat(
String.format("Expected <%s> to be <%s>, expression <%s> compiled expression <%s>", result, expectedResult, expression, compiledExpression),
- runtime.compare(expectedResult, result) == 0
+ runtime.compare(expectedResult, result),
+ is(0)
);
} else {
fail(String.format("Expected \"%s\" error", expectedError));
@@ -136,10 +137,8 @@ public Iterable getFeatureNames() {
}
}
return featureNames;
- } catch (IOException ioe) {
- throw new RuntimeException("Could not load compliance feature names", ioe);
- } catch (URISyntaxException use) {
- throw new RuntimeException("Could not load compliance feature names", use);
+ } catch (IOException | URISyntaxException e) {
+ throw new RuntimeException("Could not load compliance feature names", e);
}
}
diff --git a/jmespath-core/src/test/java/io/burt/jmespath/JmesPathRuntimeTest.java b/jmespath-core/src/test/java/io/burt/jmespath/JmesPathRuntimeTest.java
index c3a754a9..bb684300 100644
--- a/jmespath-core/src/test/java/io/burt/jmespath/JmesPathRuntimeTest.java
+++ b/jmespath-core/src/test/java/io/burt/jmespath/JmesPathRuntimeTest.java
@@ -31,7 +31,7 @@
import static org.hamcrest.Matchers.containsString;
public abstract class JmesPathRuntimeTest {
- private Adapter runtime = createRuntime(RuntimeConfiguration.defaultConfiguration());
+ private final Adapter runtime = createRuntime(RuntimeConfiguration.defaultConfiguration());
protected T contact;
protected T cloudtrail;
diff --git a/jmespath-core/src/test/java/io/burt/jmespath/jcf/JcfComplianceTest.java b/jmespath-core/src/test/java/io/burt/jmespath/jcf/JcfComplianceTest.java
index 8bf537c8..66a3be45 100644
--- a/jmespath-core/src/test/java/io/burt/jmespath/jcf/JcfComplianceTest.java
+++ b/jmespath-core/src/test/java/io/burt/jmespath/jcf/JcfComplianceTest.java
@@ -4,7 +4,7 @@
import io.burt.jmespath.Adapter;
public class JcfComplianceTest extends JmesPathComplianceTest