Skip to content

Commit f344762

Browse files
committed
1 parent 0a01bb8 commit f344762

File tree

7 files changed

+35
-18
lines changed

7 files changed

+35
-18
lines changed

.classpath

+4-8
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,23 @@
3636
<attribute name="maven.pomderived" value="true"/>
3737
</attributes>
3838
</classpathentry>
39-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
40-
<attributes>
41-
<attribute name="maven.pomderived" value="true"/>
42-
</attributes>
43-
</classpathentry>
4439
<classpathentry kind="src" path="target/generated-sources/annotations">
4540
<attributes>
41+
<attribute name="ignore_optional_problems" value="true"/>
4642
<attribute name="optional" value="true"/>
4743
<attribute name="maven.pomderived" value="true"/>
48-
<attribute name="ignore_optional_problems" value="true"/>
4944
<attribute name="m2e-apt" value="true"/>
5045
</attributes>
5146
</classpathentry>
5247
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
5348
<attributes>
49+
<attribute name="ignore_optional_problems" value="true"/>
50+
<attribute name="test" value="true"/>
5451
<attribute name="optional" value="true"/>
5552
<attribute name="maven.pomderived" value="true"/>
56-
<attribute name="ignore_optional_problems" value="true"/>
5753
<attribute name="m2e-apt" value="true"/>
58-
<attribute name="test" value="true"/>
5954
</attributes>
6055
</classpathentry>
56+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6157
<classpathentry kind="output" path="target/classes"/>
6258
</classpath>

.settings/org.eclipse.jdt.core.prefs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
125125
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
126126
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
127127
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
128-
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
128+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
129129
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
130130
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
131131
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled

README.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,18 @@ You can also opt to clone this repository using the command line below and build
2323
git clone https://github.com/IBM/JSONata4Java.git
2424
```
2525

26-
### Java 1.8 Version needed for new Antlr 4.11.1 (Also updated project file to Eclipse 2022-12)
26+
### Differences with JavaScript jsonata.org ###
2727

28-
The code was created using IBM Semeru Runtime Open Edition 11.0.17.0 (build 11.0.17+8). You can import the project into Eclipse 2023-03 or newer.
29-
You can download the Java JDK 11 from https://developer.ibm.com/languages/java/semeru-runtimes/downloads/?license=IBM
28+
The Java version uses ANTLR to build the parser for the language, and Java Objects are more tightly controlled that JavaScript Objects. Therefore, some things differ between the Java implementation and JavaScript implementation. For example:
29+
- we require functions to be called with their arguments, even if no arguments are being passed. This is because we differentiate a variable reference with no parentheses from a function that has parentheses.
30+
- we require variables to begin with a letter or an underscore (but not a number) whereas jsonata.org allows variables to begin with numbers ([Issue 267](https://github.com/IBM/JSONata4Java/issues/267)).
31+
- Arrays hold JsonNode types so can not hold references to functions, whereas jsonata.org can manage function references within an array ([Issue 268](https://github.com/IBM/JSONata4Java/issues/268)).
3032

31-
However, the build dependencies are set to allow use with Java 1.8
33+
### Java 11 and 1.8 Versions needed for new Antlr 4.11.1 (Also updated project file to Eclipse 2023-03)
34+
35+
The code was created using IBM Semeru Runtime Open Edition 11.0.17.0 (build 11.0.17+8). You can import the project into Eclipse 2023-03 or newer. This is to allow the newer version of ANTLR to generate necessary code from the g4 file defining the language. You can download the Java JDK 11 from https://developer.ibm.com/languages/java/semeru-runtimes/downloads/?license=IBM
36+
37+
** *However, the build dependencies are set to allow use with Java 1.8* **
3238

3339

3440
### Building the jar files
@@ -40,9 +46,11 @@ you can right click on the pom.xml file and select **Run as... / Maven build...*
4046

4147
![Launcher Image](./images/Launcher.png)
4248

43-
Alternatively, you can run from the command line in the JSONata4Java directory&colon; **mvn clean install -Dgpg.skip**
49+
Alternatively, you can run from the command line in the JSONata4Java directory&colon;
50+
`mvn clean install -Dgpg.skip`
4451

45-
Note: to build and deploy the jars to Maven Central you need to use a command like&colon; **mvn clean install deploy -Prelease**
52+
Note: to build and deploy the jars to Maven Central you need to use a command like&colon;
53+
`mvn clean install deploy -Prelease`
4654

4755
Once you have run the launcher, you can find the jar files in the /target directory. There are two&colon;
4856
* **JSONata4Java-2.4.1-jar-with-dependencies.jar** (thinks includes dependent jar files)

pom.xml

+6-2
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,22 @@
106106
<dependency>
107107
<groupId>com.fasterxml.jackson.core</groupId>
108108
<artifactId>jackson-databind</artifactId>
109+
<<<<<<< Upstream, based on branch 'master' of https://github.com/IBM/JSONata4Java.git
109110
<version>2.15.0</version>
111+
=======
112+
<version>2.15.1</version>
113+
>>>>>>> 170cea8 IBM/JSONata4Java#268
110114
</dependency>
111115
<!-- https://mvnrepository.com/artifact/com.fasterxml.woodstox/woodstox-core -->
112116
<dependency>
113117
<groupId>com.fasterxml.woodstox</groupId>
114118
<artifactId>woodstox-core</artifactId>
115-
<version>6.5.0</version>
119+
<version>6.5.1</version>
116120
</dependency>
117121
<dependency>
118122
<groupId>com.fasterxml.jackson.dataformat</groupId>
119123
<artifactId>jackson-dataformat-xml</artifactId>
120-
<version>2.14.2</version>
124+
<version>2.15.1</version>
121125
</dependency>
122126
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
123127
<dependency>

src/main/java/com/api/jsonata4java/expressions/ExpressionsVisitor.java

+8
Original file line numberDiff line numberDiff line change
@@ -3029,6 +3029,14 @@ public JsonNode visitVar_recall(MappingExpressionParser.Var_recallContext ctx) {
30293029
}
30303030
final String varName = ctx.getText();
30313031
JsonNode result = getVariable(varName);
3032+
// if (result == null) {
3033+
// // see if this is calling a declared function with no parameters
3034+
// DeclaredFunction declFct = getDeclaredFunction(varName);
3035+
// if (declFct != null) {
3036+
// ExprListContext exprListCtx = declFct.getExpressionList();
3037+
// result = visit(exprListCtx);
3038+
// }
3039+
// }
30323040
lastVisited = METHOD;
30333041
if (LOG.isLoggable(Level.FINEST)) {
30343042
LOG.exiting(CLASS, METHOD, (result == null ? "null" : result.toString()));

src/main/java/com/api/jsonata4java/expressions/functions/ExistsFunction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public JsonNode invoke(ExpressionsVisitor expressionVisitor, Function_callContex
4646

4747
// Retrieve the number of arguments
4848
JsonNode arg = JsonNodeFactory.instance.nullNode();
49-
boolean useContext = FunctionUtils.useContextVariable(this, ctx, getSignature());
49+
boolean useContext = false; // FunctionUtils.useContextVariable(this, ctx, getSignature());
5050
int argCount = getArgumentCount(ctx);
5151
if (useContext) {
5252
arg = FunctionUtils.getContextVariable(expressionVisitor);

testfiles/dataarray_9.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[["A","B","C"],["AA","BB","CC"]]

0 commit comments

Comments
 (0)