From 5f8d149b5e6b6409f45549e0ddaf5ed6993b5fea Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 30 Jan 2000 16:49:58 +0000 Subject: [PATCH] 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 --- jode/test/AnonymousClass.java | 7 ++++-- jode/test/AnonymousJavac.java | 2 -- jode/test/Makefile.am | 41 ++++++++++++++++++++++++++++++++- jode/test/NestedAnon.java | 4 ++++ jode/test/ResolveConflicts.java | 38 +++++++++++++++++++++++++++--- jode/test/simpletests.sh | 20 +++++++++------- 6 files changed, 96 insertions(+), 16 deletions(-) diff --git a/jode/test/AnonymousClass.java b/jode/test/AnonymousClass.java index 0ee1046..07800b8 100644 --- a/jode/test/AnonymousClass.java +++ b/jode/test/AnonymousClass.java @@ -20,6 +20,8 @@ import java.util.Vector; public class AnonymousClass { +///#ifndef JAVAC11 + // javac 1.1 is tooooooo broken class Inner { int var = 3; @@ -40,7 +42,6 @@ public class AnonymousClass { Hello(String info) { System.err.println("construct: "+info); } -///#ifndef JAVAC11 ///#ifndef JAVAC12 ///#ifndef JIKES0 Hello(int i) { @@ -48,7 +49,6 @@ public class AnonymousClass { +" by a recent jikes"); } ///#endif -///#endif ///#endif private void hello() { this.hashCode(); @@ -105,6 +105,7 @@ public class AnonymousClass { } } +///#ifndef JAVAC12 class Huhu extends Hello { public Huhu(String str) { super(str); @@ -117,6 +118,7 @@ public class AnonymousClass { super("What's up"); } } +///#endif Vector v = new Vector(hi.var, new Inner("blah").var) { public String newMethod() { @@ -198,4 +200,5 @@ public class AnonymousClass { Hi hu = new Hi(); } +///#endif } diff --git a/jode/test/AnonymousJavac.java b/jode/test/AnonymousJavac.java index 3fc115b..8e13423 100644 --- a/jode/test/AnonymousJavac.java +++ b/jode/test/AnonymousJavac.java @@ -177,7 +177,5 @@ public class AnonymousJavac { }; Hi hu = new Hi(); - } - } diff --git a/jode/test/Makefile.am b/jode/test/Makefile.am index b4cdef2..21435ed 100644 --- a/jode/test/Makefile.am +++ b/jode/test/Makefile.am @@ -1,6 +1,45 @@ JAVA = @JAVA@ JAVAC = @JAVAC@ +CLASSLIB = @CLASSLIB@ 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 + +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 \ No newline at end of file diff --git a/jode/test/NestedAnon.java b/jode/test/NestedAnon.java index dfe0089..863468d 100644 --- a/jode/test/NestedAnon.java +++ b/jode/test/NestedAnon.java @@ -3,12 +3,16 @@ public class NestedAnon { public NestedAnon(int maxdepth) { class NestMyself { int depth; +///#ifndef JAVAC11 NestMyself son; +///#endif public NestMyself(int d) { depth = d; +///#ifndef JAVAC11 if (d > 0) son = new NestMyself(d-1); +///#endif } } new NestMyself(maxdepth); diff --git a/jode/test/ResolveConflicts.java b/jode/test/ResolveConflicts.java index ecaab58..c115dc3 100644 --- a/jode/test/ResolveConflicts.java +++ b/jode/test/ResolveConflicts.java @@ -32,7 +32,11 @@ public class ResolveConflicts Conflicts Inner; void Conflicts() { +///#ifndef JAVAC11 +///#ifndef JAVAC12 Inner = ResolveConflicts.Conflicts.this; +///#endif +///#endif } } @@ -48,9 +52,13 @@ public class ResolveConflicts void Inner() { this.Inner.Inner(); - ResolveConflicts.Conflicts.Inner.this.Inner.Inner(); this.Conflicts(); +///#ifndef JAVAC11 +///#ifndef JAVAC12 + ResolveConflicts.Conflicts.Inner.this.Inner.Inner(); ResolveConflicts.Conflicts.Inner.this.Conflicts(); +///#endif +///#endif } Blah() { @@ -67,16 +75,30 @@ public class ResolveConflicts Conflicts(); new Object() { void Inner() { +///#ifndef JAVAC11 +///#ifndef JAVAC12 ResolveConflicts.Conflicts.this.Inner(); +///#endif +///#endif } }; this.Conflicts = Conflicts; Inner(); +///#ifndef JAVAC11 +///#ifndef JAVAC12 ResolveConflicts.Conflicts.this.Conflicts = this.Conflicts; +///#endif +///#endif } 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() { - 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) { diff --git a/jode/test/simpletests.sh b/jode/test/simpletests.sh index 3f2290a..1830904 100755 --- a/jode/test/simpletests.sh +++ b/jode/test/simpletests.sh @@ -4,18 +4,22 @@ TEMP=`mktemp -d tmp.XXXXXX` if echo $JAVAC | grep jikes >/dev/null; then 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 - compiler=`$JAVAC -J-version 2>&1 | grep version | \ - perl -pe's/^.*version \"?([0-9]+)\.([0-9]+).*$/JAVAC\1\2/'` + compiler=JAVAC + version=`$JAVAC -J-version 2>&1 | grep version | \ + perl -pe's/^.*version \"?([0-9]+)\.([0-9]+).*$/\1\2/'` else compiler=UNKNOWN + version="" fi echo "detected compiler $compiler" error="" -EXPECT_FAIL="ResolveConflicts.java AnonymousClass.java InnerClass.java" +EXPECT_FAIL="" for testclass in \ ArrayCloneTest.java \ @@ -36,13 +40,13 @@ Unreach.java \ AnonymousClass.java \ InnerClass.java \ InnerCompat.java \ -NestedAnon.java +NestedAnon.java do cp $srcdir/$testclass $TEMP - $top_srcdir/jcpp -D$compiler $TEMP/$testclass - $JAVAC $JFLAGS -d $TEMP $TEMP/$testclass - CLASSPATH=$top_builddir:$CLASSPATH $JAVA jode.Decompiler \ - --classpath=$TEMP --dest=$TEMP ${testclass%.java} &> $testclass.log + $top_srcdir/jcpp -D$compiler -D$compiler$version $TEMP/$testclass + CLASSPATH=$CLASSPATH:$CLASSLIB $JAVAC $JFLAGS -d $TEMP $TEMP/$testclass + CLASSPATH=$CLASSPATH:$CLASSLIB $JAVA jode.Decompiler \ + --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 cat $TEMP/$testclass >> $testclass.log CLASSPATH=$TEMP:$CLASSPATH javap -c ${testclass%.java} >> $testclass.log