Details
-
Bug
-
Resolution: Fixed
-
P2
-
None
-
b83
-
Not verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8142060 | emb-9 | Martin Buchholz | P2 | Resolved | Fixed | team |
Description
There is the one true modifier order documented in the JLS and Modifier#toString(). The JDK sources should use it.
Here's my one weird hack to make it so:
#!/bin/bash
# See
# https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Modifier.html#toString-int-
#
# blessed-modifier-order src/java.base test/java/{util,io,lang}
set -eu
declare -ar dirs=("$@")
declare -ar modifiers=(
public protected private
abstract static final transient
volatile synchronized native strictfp
)
declare -r SAVE_IFS="$IFS"
for ((i = 3; i < "${#modifiers[@]}"; i++)); do
IFS='|'; x="${modifiers[*]:0:i}" y="${modifiers[*]:i}"; IFS="$SAVE_IFS"
if [[ -n "$x" && -n "$y" ]]; then
find "${dirs[@]}" -name '*.java' -type f | xargs perl -p -i -e \
"do {} while s/^([A-Za-z@ ]*)\b($y) +($x)\b/\1\3 \2/"
fi
done
Here's my one weird hack to make it so:
#!/bin/bash
# See
# https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Modifier.html#toString-int-
#
# blessed-modifier-order src/java.base test/java/{util,io,lang}
set -eu
declare -ar dirs=("$@")
declare -ar modifiers=(
public protected private
abstract static final transient
volatile synchronized native strictfp
)
declare -r SAVE_IFS="$IFS"
for ((i = 3; i < "${#modifiers[@]}"; i++)); do
IFS='|'; x="${modifiers[*]:0:i}" y="${modifiers[*]:i}"; IFS="$SAVE_IFS"
if [[ -n "$x" && -n "$y" ]]; then
find "${dirs[@]}" -name '*.java' -type f | xargs perl -p -i -e \
"do {} while s/^([A-Za-z@ ]*)\b($y) +($x)\b/\1\3 \2/"
fi
done
Attachments
Issue Links
- backported by
-
JDK-8142060 Core libraries should use blessed modifier order
- Resolved
- relates to
-
JDK-8276348 Use blessed modifier order in java.base
- Resolved
-
JDK-8136656 Check in blessed-modifier-order.sh
- Resolved