Skip to content

Commit 69cd0ae

Browse files
authored
Merge pull request #8 from arjantijms/fixtckfailures
Fix TCK failures
2 parents 8a48034 + 7c364ab commit 69cd0ae

Some content is hidden

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

53 files changed

+7150
-6469
lines changed

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<dependency>
7979
<groupId>jakarta.el</groupId>
8080
<artifactId>jakarta.el-api</artifactId>
81-
<version>5.0.0-RC1</version>
81+
<version>5.0.0</version>
8282
</dependency>
8383
<dependency>
8484
<groupId>junit</groupId>
@@ -137,6 +137,7 @@
137137
<artifactId>maven-bundle-plugin</artifactId>
138138
<version>5.1.4</version>
139139
<configuration>
140+
<supportIncrementalBuild>true</supportIncrementalBuild>
140141
<instructions>
141142
<Bundle-SymbolicName>org.glassfish.expressly</Bundle-SymbolicName>
142143
<_include>-osgi.bundle</_include>
@@ -179,7 +180,7 @@
179180
<plugin>
180181
<groupId>org.apache.maven.plugins</groupId>
181182
<artifactId>maven-compiler-plugin</artifactId>
182-
<version>3.9.0</version>
183+
<version>3.10.1</version>
183184
<configuration>
184185
<release>11</release>
185186
<compilerArgument>-Xlint:unchecked</compilerArgument>

src/main/java/org/glassfish/expressly/ExpressionFactoryImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation.
23
* Copyright (c) 1997, 2021 Oracle and/or its affiliates and others.
34
* All rights reserved.
45
*
@@ -66,7 +67,7 @@ public ExpressionFactoryImpl(Properties properties) {
6667
@Override
6768
public <T> T coerceToType(Object obj, Class<T> type) {
6869
try {
69-
return ELSupport.coerceToType(obj, type, isBackwardCompatible22);
70+
return ELSupport.coerceToType(null, obj, type, isBackwardCompatible22);
7071
} catch (IllegalArgumentException ex) {
7172
throw new ELException(ex);
7273
}

src/main/java/org/glassfish/expressly/MethodExpressionImpl.java

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation.
23
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
34
*
45
* This program and the accompanying materials are made available under the
@@ -38,6 +39,7 @@
3839
import jakarta.el.MethodExpression;
3940
import jakarta.el.MethodInfo;
4041
import jakarta.el.MethodNotFoundException;
42+
import jakarta.el.MethodReference;
4143
import jakarta.el.PropertyNotFoundException;
4244
import jakarta.el.VariableMapper;
4345

@@ -77,9 +79,9 @@
7779
public final class MethodExpressionImpl extends MethodExpression implements Externalizable {
7880

7981
private Class<?> expectedType;
80-
private String expr;
81-
private FunctionMapper fnMapper;
82-
private VariableMapper varMapper;
82+
private String expression;
83+
private FunctionMapper functionMapper;
84+
private VariableMapper variableMapper;
8385
private Class<?>[] paramTypes;
8486

8587
private transient Node node;
@@ -98,10 +100,10 @@ public MethodExpressionImpl() {
98100
*/
99101
public MethodExpressionImpl(String expr, Node node, FunctionMapper fnMapper, VariableMapper varMapper, Class<?> expectedType, Class<?>[] paramTypes) {
100102
super();
101-
this.expr = expr;
103+
this.expression = expr;
102104
this.node = node;
103-
this.fnMapper = fnMapper;
104-
this.varMapper = varMapper;
105+
this.functionMapper = fnMapper;
106+
this.variableMapper = varMapper;
105107
this.expectedType = expectedType;
106108
this.paramTypes = paramTypes;
107109
}
@@ -156,7 +158,7 @@ public boolean equals(Object obj) {
156158
*/
157159
@Override
158160
public String getExpressionString() {
159-
return expr;
161+
return expression;
160162
}
161163

162164
/**
@@ -176,7 +178,16 @@ public String getExpressionString() {
176178
*/
177179
@Override
178180
public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException {
179-
return getNode().getMethodInfo(new EvaluationContext(context, fnMapper, varMapper), paramTypes);
181+
return getNode().getMethodInfo(new EvaluationContext(context, functionMapper, variableMapper), paramTypes);
182+
}
183+
184+
@Override
185+
public MethodReference getMethodReference(ELContext context) {
186+
EvaluationContext ctx = new EvaluationContext(context, functionMapper, variableMapper);
187+
ctx.notifyBeforeEvaluation(getExpressionString());
188+
MethodReference methodReference = getNode().getMethodReference(ctx);
189+
ctx.notifyAfterEvaluation(getExpressionString());
190+
return methodReference;
180191
}
181192

182193
/**
@@ -185,7 +196,7 @@ public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundExcept
185196
*/
186197
private Node getNode() throws ELException {
187198
if (node == null) {
188-
node = ExpressionBuilder.createNode(expr);
199+
node = ExpressionBuilder.createNode(expression);
189200
}
190201

191202
return node;
@@ -231,12 +242,12 @@ public int hashCode() {
231242
*/
232243
@Override
233244
public Object invoke(ELContext context, Object[] params) throws PropertyNotFoundException, MethodNotFoundException, ELException {
234-
EvaluationContext ctx = new EvaluationContext(context, fnMapper, varMapper);
235-
ctx.notifyBeforeEvaluation(expr);
245+
EvaluationContext ctx = new EvaluationContext(context, functionMapper, variableMapper);
246+
ctx.notifyBeforeEvaluation(expression);
236247

237248
Object obj = getNode().invoke(ctx, paramTypes, params);
238249

239-
ctx.notifyAfterEvaluation(expr);
250+
ctx.notifyAfterEvaluation(expression);
240251
return obj;
241252
}
242253

@@ -247,30 +258,25 @@ public Object invoke(ELContext context, Object[] params) throws PropertyNotFound
247258
*/
248259
@Override
249260
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
250-
expr = in.readUTF();
261+
expression = in.readUTF();
251262
String type = in.readUTF();
252263

253264
if (!"".equals(type)) {
254265
expectedType = forName(type);
255266
}
256267

257268
paramTypes = toTypeArray(((String[]) in.readObject()));
258-
fnMapper = (FunctionMapper) in.readObject();
259-
varMapper = (VariableMapper) in.readObject();
269+
functionMapper = (FunctionMapper) in.readObject();
270+
variableMapper = (VariableMapper) in.readObject();
260271
}
261272

262-
/*
263-
* (non-Javadoc)
264-
*
265-
* @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
266-
*/
267273
@Override
268274
public void writeExternal(ObjectOutput out) throws IOException {
269-
out.writeUTF(expr);
275+
out.writeUTF(expression);
270276
out.writeUTF(expectedType != null ? expectedType.getName() : "");
271277
out.writeObject(toTypeNameArray(paramTypes));
272-
out.writeObject(fnMapper);
273-
out.writeObject(varMapper);
278+
out.writeObject(functionMapper);
279+
out.writeObject(variableMapper);
274280
}
275281

276282
@Override

src/main/java/org/glassfish/expressly/MethodExpressionLiteral.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation.
23
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
34
*
45
* This program and the accompanying materials are made available under the
@@ -34,40 +35,40 @@
3435
public class MethodExpressionLiteral extends MethodExpression implements Externalizable {
3536

3637
private Class<?> expectedType;
37-
private String expr;
38+
private String expression;
3839
private Class<?>[] paramTypes;
3940

4041
public MethodExpressionLiteral() {
4142
// do nothing
4243
}
4344

44-
public MethodExpressionLiteral(String expr, Class<?> expectedType, Class<?>[] paramTypes) {
45-
this.expr = expr;
45+
public MethodExpressionLiteral(String expression, Class<?> expectedType, Class<?>[] paramTypes) {
46+
this.expression = expression;
4647
this.expectedType = expectedType;
4748
this.paramTypes = paramTypes;
4849
}
4950

5051
@Override
5152
public MethodInfo getMethodInfo(ELContext context) throws ELException {
52-
return new MethodInfo(expr, expectedType, paramTypes);
53+
return new MethodInfo(expression, expectedType, paramTypes);
5354
}
5455

5556
@Override
5657
public Object invoke(ELContext context, Object[] params) throws ELException {
5758
if (expectedType == null) {
58-
return expr;
59+
return expression;
5960
}
6061

6162
try {
62-
return context.convertToType(expr, expectedType);
63+
return context.convertToType(expression, expectedType);
6364
} catch (Exception ex) {
6465
throw new ELException(ex);
6566
}
6667
}
6768

6869
@Override
6970
public String getExpressionString() {
70-
return expr;
71+
return expression;
7172
}
7273

7374
@Override
@@ -77,7 +78,7 @@ public boolean equals(Object obj) {
7778

7879
@Override
7980
public int hashCode() {
80-
return expr.hashCode();
81+
return expression.hashCode();
8182
}
8283

8384
@Override
@@ -87,7 +88,7 @@ public boolean isLiteralText() {
8788

8889
@Override
8990
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
90-
expr = in.readUTF();
91+
expression = in.readUTF();
9192
String type = in.readUTF();
9293

9394
if (!"".equals(type)) {
@@ -99,7 +100,7 @@ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundExcept
99100

100101
@Override
101102
public void writeExternal(ObjectOutput out) throws IOException {
102-
out.writeUTF(expr);
103+
out.writeUTF(expression);
103104
out.writeUTF(expectedType != null ? expectedType.getName() : "");
104105
out.writeObject(toTypeNameArray(paramTypes));
105106
}

0 commit comments

Comments
 (0)