blob: 15382cf8003ca6b8bc997431493709b89802de28 (
plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#!/bin/sh
# @testcase public introductions not visible in libraries given to javac or jikes
# @testcase synthetic members should not be visible from libraries given to ajc todo??
# @process-test ajc publicIntroduction.sh # two testcase for public introductions
[ -n "$DEBUG" ] && set -vx
echo "before running: define (install) AJ_BASE and add #!/bin/sh to scripts"
scriptDir=`dirname "$0"`
scriptName=`basename "$0" .sh`
tempDir=temp${scriptName}
JDKDIR="${JDKDIR:-${JAVA_HOME:-`type java | sed -n '/bin\/java/s|/bin/java.*||p'`}}"
AJ_BASE="${AJ_BASE:-`type ajc | sed -n '/bin\/ajc/s|/bin/ajc.*||p'`}"
ajLib="${AJ_BASE}/lib/aspectjrt.jar"
PS="${PS:-;}" # todo
errMssg() {
[ -n "$1" ] && echo "## FAIL: $1"
[ -n "$2" ] && exit "$2"
}
makeSources() {
cat > Javap.java<<EOF
public class Javap {
interface I {
void i();
}
class C {}
static aspect A {
public void I.i() {}
declare parents: C implements I;
}
}
EOF
cat > Target.java <<EOF
public class Target {
// regular members
public long publicLong;
public long getPublicLong() { return publicLong; }
}
aspect A {
// introduced members
public int Target.publicInt;
public int Target.getPublicInt() {
return publicInt;
}
public static int Target.staticPublicInt;
public static int Target.getStaticPublicInt() {
return staticPublicInt;
}
}
EOF
mkdir user
cat > user/TargetUser.java<<EOF
public class TargetUser {
public static void main (String[] args) {
Target me = new Target();
// regular members
long l = me.publicLong;
l = me.getPublicLong();
// introduced members
int i = me.publicInt;
i = me.getPublicInt();
i = me.getStaticPublicInt();
i = me.staticPublicInt;
}
}
EOF
}
#############################################################
curdir=`pwd`
[ ! -d "$tempDir" ] && mkdir -p "$tempDir"
cd "$tempDir" || errMssg "unable to creat temp dir" 3
[ -z "$JDKDIR" ] \
&& errMssg "expecting \$JDKDIR/bin/java: $JDKDIR/bin/java" 3
[ -z "$AJ_BASE" ] \
&& errMssg "expecting \$AJ_BASE/bin/ajc: $AJ_BASE/bin/ajc" 3
makeSources
mkdir classes
### javap case - PR#649
cmdName=ajc.javap
"$AJ_BASE/bin/ajc" -classpath "$ajLib" \
-d classes Javap.java \
> $cmdName.txt 2>&1 \
|| errMssg "$cmdName: `cat $cmdName.txt`" 3
cmdName=javap
"$JDKDIR/bin/javap" -classpath "$ajLib${PS}classes" Javap \
> $cmdName.txt 2>&1 \
|| errMssg "$cmdName: `cat $cmdName.txt`" 3
# javac case - PR#646
cmdName=ajc
"$AJ_BASE/bin/ajc" -classpath "$ajLib" \
-d classes Target.java \
> $cmdName.txt 2>&1 \
|| errMssg "$cmdName: `cat ../$cmdName.txt`" 3
cd user
cmdName=../javac
"$JDKDIR/bin/javac" -classpath ../classes -d ../classes TargetUser.java \
> $cmdName.txt 2>&1 \
|| errMssg "$cmdName: `cat $cmdName.txt`" 3
cd ..
cmdName=java
"$JDKDIR/bin/java" -classpath "$ajLib${PS}classes" TargetUser \
> $cmdName.txt 2>&1 \
|| errMssg "$cmdName: `cat $cmdName.txt`" 3
cd "$curdir"
rm -rf "$tempDir"
echo "tests passed if they got to this point..."
|