File: compare-java-sigs

package info (click to toggle)
scala 2.11.12-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 62,828 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,250; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (56 lines) | stat: -rw-r--r-- 1,816 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#
# Compare javac -Xprint (i.e. see signatures from java point of view)
# for the given classes.
#
# Sample:
#
# % SCALA_HOME=/scala/inst/29 SCALA_BUILD=/scala/inst/3 tools/compare-java-sigs 'scala.Predef$'
#
# Comparing javac -Xprint for scala.Predef$ based on '/scala/inst/29' and '/scala/inst/3'
# 3c3
# < public final class Predef$ extends scala.LowPriorityImplicits implements scala.ScalaObject {
# ---
# > public final class Predef$ extends scala.LowPriorityImplicits {
# 7d6
# <   private final scala.SpecializableCompanion AnyRef;
# 21,22d19
# <   public scala.SpecializableCompanion AnyRef();
# <
# 68a66,67
# >   public scala.runtime.Nothing$ $qmark$qmark$qmark();
# >
# 225c224,226
# <   public scala.collection.immutable.StringOps augmentString(java.lang.String x);
# ---
# >   public scala.runtime.StringFormat any2stringfmt(java.lang.Object x);
# >
# >   public java.lang.String augmentString(java.lang.String x);
# 227c228
# <   public java.lang.String unaugmentString(scala.collection.immutable.StringOps x);
# ---
# >   public java.lang.String unaugmentString(java.lang.String x);
#

set -e

[[ $# -gt 0 ]] || {
  echo "Usage: $(basename $0) <class> <class> ..."
  echo ""
  echo "# Example usage"
  echo "SCALA_HOME=/scala/inst/29 SCALA_BUILD=/scala/inst/3 \\"
  echo "  $(basename $0) scala.Function1 scala.runtime.AbstractFunction1"
  exit 0
}

home1=$(cd ${SCALA_HOME:-/scala/inst/3} && pwd)
home2=$(cd ${SCALA_BUILD:-$(dirname $BASH_SOURCE)/../build/pack} && pwd)

echo "Comparing javac -Xprint for $@ based on '$home1' and '$home2'"
tmpdir=$(mktemp -dt $(basename $BASH_SOURCE))

cd $tmpdir
javac -Xprint -cp $home1:$home1/lib/'*' "$@" > before.txt
javac -Xprint -cp $home2:$home2/lib/'*' "$@" > after.txt

diff before.txt after.txt && echo "No differences in javac -Xprint output."