Makefile optimized

Some tests changed so they work under all compilers


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1224 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent 7628ebc073
commit 5f8d149b5e
  1. 7
      jode/test/AnonymousClass.java
  2. 2
      jode/test/AnonymousJavac.java
  3. 41
      jode/test/Makefile.am
  4. 4
      jode/test/NestedAnon.java
  5. 38
      jode/test/ResolveConflicts.java
  6. 20
      jode/test/simpletests.sh

@ -20,6 +20,8 @@
import java.util.Vector; import java.util.Vector;
public class AnonymousClass { public class AnonymousClass {
///#ifndef JAVAC11
// javac 1.1 is tooooooo broken
class Inner { class Inner {
int var = 3; int var = 3;
@ -40,7 +42,6 @@ public class AnonymousClass {
Hello(String info) { Hello(String info) {
System.err.println("construct: "+info); System.err.println("construct: "+info);
} }
///#ifndef JAVAC11
///#ifndef JAVAC12 ///#ifndef JAVAC12
///#ifndef JIKES0 ///#ifndef JIKES0
Hello(int i) { Hello(int i) {
@ -48,7 +49,6 @@ public class AnonymousClass {
+" by a recent jikes"); +" by a recent jikes");
} }
///#endif ///#endif
///#endif
///#endif ///#endif
private void hello() { private void hello() {
this.hashCode(); this.hashCode();
@ -105,6 +105,7 @@ public class AnonymousClass {
} }
} }
///#ifndef JAVAC12
class Huhu extends Hello { class Huhu extends Hello {
public Huhu(String str) { public Huhu(String str) {
super(str); super(str);
@ -117,6 +118,7 @@ public class AnonymousClass {
super("What's up"); super("What's up");
} }
} }
///#endif
Vector v = new Vector(hi.var, new Inner("blah").var) { Vector v = new Vector(hi.var, new Inner("blah").var) {
public String newMethod() { public String newMethod() {
@ -198,4 +200,5 @@ public class AnonymousClass {
Hi hu = new Hi(); Hi hu = new Hi();
} }
///#endif
} }

@ -177,7 +177,5 @@ public class AnonymousJavac {
}; };
Hi hu = new Hi(); Hi hu = new Hi();
} }
} }

@ -1,6 +1,45 @@
JAVA = @JAVA@ JAVA = @JAVA@
JAVAC = @JAVAC@ JAVAC = @JAVAC@
CLASSLIB = @CLASSLIB@
JFLAGS = JFLAGS =
TESTS_ENVIRONMENT=JAVA=$(JAVA) JAVAC=$(JAVAC) JFLAGS=$(JFLAGS) srcdir=$(srcdir) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) TESTS_ENVIRONMENT=JAVA=$(JAVA) JAVAC=$(JAVAC) JFLAGS=$(JFLAGS) srcdir=$(srcdir) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) CLASSLIB=$(CLASSLIB)
TESTS = simpletests.sh TESTS = simpletests.sh
EXTRA_DIST = \
simpletests.sh \
AnonymousClass.java \
AnonymousJavac.java \
ArrayCloneTest.java \
ArrayTest.java \
AssignOp.java \
Base.j \
Child.j \
ClassOpTest.java \
ConstantTypes.java \
CountOpcodes.java \
EvilTypes.j \
Expressions.java \
Flow.java \
For.java \
HintTypeTest.java \
IfCombine.java \
InlineTest.java \
InlinedAnon.java \
InnerClass.java \
InnerCompat.java \
JavacBug.java \
JsrTest.j \
LocalTypes.java \
MethodScopedClass.java \
NestedAnon.java \
ObfuscateStrings.j \
OptimizeTest.java \
OptimizerTest.java \
PrivateHideTest.java \
RemovePopExample.j \
ResolveConflicts.java \
StackOps.j \
TriadicExpr.java \
TryCatch.java \
Unreach.java

@ -3,12 +3,16 @@ public class NestedAnon {
public NestedAnon(int maxdepth) { public NestedAnon(int maxdepth) {
class NestMyself { class NestMyself {
int depth; int depth;
///#ifndef JAVAC11
NestMyself son; NestMyself son;
///#endif
public NestMyself(int d) { public NestMyself(int d) {
depth = d; depth = d;
///#ifndef JAVAC11
if (d > 0) if (d > 0)
son = new NestMyself(d-1); son = new NestMyself(d-1);
///#endif
} }
} }
new NestMyself(maxdepth); new NestMyself(maxdepth);

@ -32,7 +32,11 @@ public class ResolveConflicts
Conflicts Inner; Conflicts Inner;
void Conflicts() { void Conflicts() {
///#ifndef JAVAC11
///#ifndef JAVAC12
Inner = ResolveConflicts.Conflicts.this; Inner = ResolveConflicts.Conflicts.this;
///#endif
///#endif
} }
} }
@ -48,9 +52,13 @@ public class ResolveConflicts
void Inner() { void Inner() {
this.Inner.Inner(); this.Inner.Inner();
ResolveConflicts.Conflicts.Inner.this.Inner.Inner();
this.Conflicts(); this.Conflicts();
///#ifndef JAVAC11
///#ifndef JAVAC12
ResolveConflicts.Conflicts.Inner.this.Inner.Inner();
ResolveConflicts.Conflicts.Inner.this.Conflicts(); ResolveConflicts.Conflicts.Inner.this.Conflicts();
///#endif
///#endif
} }
Blah() { Blah() {
@ -67,16 +75,30 @@ public class ResolveConflicts
Conflicts(); Conflicts();
new Object() { new Object() {
void Inner() { void Inner() {
///#ifndef JAVAC11
///#ifndef JAVAC12
ResolveConflicts.Conflicts.this.Inner(); ResolveConflicts.Conflicts.this.Inner();
///#endif
///#endif
} }
}; };
this.Conflicts = Conflicts; this.Conflicts = Conflicts;
Inner(); Inner();
///#ifndef JAVAC11
///#ifndef JAVAC12
ResolveConflicts.Conflicts.this.Conflicts = this.Conflicts; ResolveConflicts.Conflicts.this.Conflicts = this.Conflicts;
///#endif
///#endif
} }
Conflicts Conflicts(Inner Conflicts) { Conflicts Conflicts(Inner Conflicts) {
return ResolveConflicts.Conflicts.this; ///#ifndef JAVAC11
///#ifndef JAVAC12
ResolveConflicts.Conflicts Inner
= ResolveConflicts.Conflicts.this;
///#endif
///#endif
return ResolveConflicts.this.new Conflicts();
} }
} }
@ -90,7 +112,17 @@ public class ResolveConflicts
} }
Conflicts.Inner create() { Conflicts.Inner create() {
return ResolveConflicts.Conflicts.this.new Inner(); ///#ifndef JAVAC11
///#ifndef JAVAC12
ResolveConflicts.Conflicts.Inner inner
= ResolveConflicts.Conflicts.this.new Inner();
///#endif
///#endif
///#ifdef JAVAC11
return null;
///#else
return ResolveConflicts.this.new Conflicts().new Inner();
///#endif
} }
Second(Conflicts.Inner Blah) { Second(Conflicts.Inner Blah) {

@ -4,18 +4,22 @@ TEMP=`mktemp -d tmp.XXXXXX`
if echo $JAVAC | grep jikes >/dev/null; then if echo $JAVAC | grep jikes >/dev/null; then
compiler=JIKES; compiler=JIKES;
version=`$JAVAC 2>&1 | grep Version | \
perl -pe's/^.*Version \"?([0-9]+)\.([0-9]+).*$/\1/'`
elif echo $JAVAC | grep javac >/dev/null; then elif echo $JAVAC | grep javac >/dev/null; then
compiler=`$JAVAC -J-version 2>&1 | grep version | \ compiler=JAVAC
perl -pe's/^.*version \"?([0-9]+)\.([0-9]+).*$/JAVAC\1\2/'` version=`$JAVAC -J-version 2>&1 | grep version | \
perl -pe's/^.*version \"?([0-9]+)\.([0-9]+).*$/\1\2/'`
else else
compiler=UNKNOWN compiler=UNKNOWN
version=""
fi fi
echo "detected compiler $compiler" echo "detected compiler $compiler"
error="" error=""
EXPECT_FAIL="ResolveConflicts.java AnonymousClass.java InnerClass.java" EXPECT_FAIL=""
for testclass in \ for testclass in \
ArrayCloneTest.java \ ArrayCloneTest.java \
@ -36,13 +40,13 @@ Unreach.java \
AnonymousClass.java \ AnonymousClass.java \
InnerClass.java \ InnerClass.java \
InnerCompat.java \ InnerCompat.java \
NestedAnon.java NestedAnon.java
do do
cp $srcdir/$testclass $TEMP cp $srcdir/$testclass $TEMP
$top_srcdir/jcpp -D$compiler $TEMP/$testclass $top_srcdir/jcpp -D$compiler -D$compiler$version $TEMP/$testclass
$JAVAC $JFLAGS -d $TEMP $TEMP/$testclass CLASSPATH=$CLASSPATH:$CLASSLIB $JAVAC $JFLAGS -d $TEMP $TEMP/$testclass
CLASSPATH=$top_builddir:$CLASSPATH $JAVA jode.Decompiler \ CLASSPATH=$CLASSPATH:$CLASSLIB $JAVA jode.Decompiler \
--classpath=$TEMP --dest=$TEMP ${testclass%.java} &> $testclass.log --classpath=$TEMP --dest=$TEMP ${testclass%.java} > $testclass.log 2>&1
if ! CLASSPATH=$TEMP:$CLASSPATH $JAVAC $JFLAGS -d $TEMP $TEMP/$testclass >> $testclass.log 2>&1 ; then if ! CLASSPATH=$TEMP:$CLASSPATH $JAVAC $JFLAGS -d $TEMP $TEMP/$testclass >> $testclass.log 2>&1 ; then
cat $TEMP/$testclass >> $testclass.log cat $TEMP/$testclass >> $testclass.log
CLASSPATH=$TEMP:$CLASSPATH javap -c ${testclass%.java} >> $testclass.log CLASSPATH=$TEMP:$CLASSPATH javap -c ${testclass%.java} >> $testclass.log

Loading…
Cancel
Save