Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IPDSnelting
mjtest-tests
Commits
375d1aae
Commit
375d1aae
authored
Nov 28, 2021
by
I-Al-Istannen
Browse files
Add tests for assignment evaluation orders
See
https://docs.oracle.com/javase/specs/jls/se17/html/jls-15.html#jls-15.26.1
parent
cd0c240a
Pipeline
#179227
failed with stage
in 15 minutes and 14 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
exec/ArrayIndexEvaluationOrder.java
0 → 100644
View file @
375d1aae
class
ArrayIndexEvaluationOrder
{
public
int
val
;
public
int
[]
arr
;
public
ArrayIndexEvaluationOrder
init
()
{
this
.
arr
=
new
int
[
20
];
this
.
val
=
0
;
return
this
;
}
public
int
[]
fetchArrWithSideEffect
()
{
val
=
42
;
return
arr
;
}
public
int
fetchIndexWithSideEffect
()
{
val
=
21
;
return
1
;
}
public
void
check
()
{
fetchArrWithSideEffect
()[
fetchIndexWithSideEffect
()]
=
10
;
System
.
out
.
println
(
val
);
System
.
out
.
println
(
arr
[
1
]);
}
public
static
void
main
(
String
[]
args
)
{
new
ArrayIndexEvaluationOrder
().
init
().
check
();
}
}
exec/ArrayIndexEvaluationOrder.java.out
0 → 100644
View file @
375d1aae
21
10
exec/AssignmentEvaluationOrder.java
0 → 100644
View file @
375d1aae
class
AssignmentEvaluationOrder
{
public
int
x
;
public
int
[]
arr
;
public
AssignmentEvaluationOrder
init
()
{
arr
=
new
int
[
20
];
x
=
10
;
return
this
;
}
public
void
check
()
{
arr
[
x
=
5
]
=
x
;
System
.
out
.
println
(
arr
[
5
]);
}
public
static
void
main
(
String
[]
args
)
{
new
AssignmentEvaluationOrder
().
init
().
check
();
}
}
exec/AssignmentEvaluationOrder.java.out
0 → 100644
View file @
375d1aae
5
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment