Remove jode.test package

made a simple script to test these classes automatically


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1149 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent 15e5e76033
commit 75cc1c2c9d
  1. 23
      jode/test/AnonymousClass.java
  2. 1
      jode/test/AnonymousJavac.java
  3. 1
      jode/test/ArrayCloneTest.java
  4. 1
      jode/test/ArrayTest.java
  5. 1
      jode/test/AssignOp.java
  6. 2
      jode/test/Base.j
  7. 14
      jode/test/Child.j
  8. 1
      jode/test/ClassOpTest.java
  9. 112
      jode/test/Conflicts.java
  10. 1
      jode/test/ConstantTypes.java
  11. 12
      jode/test/EvilTypes.j
  12. 1
      jode/test/Expressions.java
  13. 1
      jode/test/Flow.java
  14. 1
      jode/test/For.java
  15. 1
      jode/test/HintTypeTest.java
  16. 1
      jode/test/IfCombine.java
  17. 1
      jode/test/InlineTest.java
  18. 1
      jode/test/InlinedAnon.java
  19. 1
      jode/test/InnerClass.java
  20. 1
      jode/test/InnerCompat.java
  21. 1
      jode/test/JavacBug.java
  22. 1
      jode/test/LocalTypes.java
  23. 6
      jode/test/Makefile.am
  24. 1
      jode/test/NestedAnon.java
  25. 2
      jode/test/ObfuscateStrings.j
  26. 5
      jode/test/OptimizeTest.java
  27. 1
      jode/test/OptimizerTest.java
  28. 112
      jode/test/ResolveConflicts.java
  29. 2
      jode/test/StackOps.j
  30. 1
      jode/test/TriadicExpr.java
  31. 3
      jode/test/TryCatch.java
  32. 1
      jode/test/Unreach.java
  33. 66
      jode/test/simpletests.sh

@ -17,8 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
import java.util.Vector; import java.util.Vector;
public class AnonymousClass { public class AnonymousClass {
@ -42,7 +40,18 @@ public class AnonymousClass {
Hello(String info) { Hello(String info) {
System.err.println("construct: "+info); System.err.println("construct: "+info);
} }
///#ifndef JAVAC11
///#ifndef JAVAC12
///#ifndef JIKES
/// Hello(int i) {
/// this("If you find a compiler that can compile this,"
/// +" please comment this out and tell me if "
/// +"decompilation works.\n"
/// +"jikes 0.47, javac 1.2 are both broken!");
/// }
///#endif
///#endif
///#endif
public void hello() { public void hello() {
this.hashCode(); this.hashCode();
Inner.this.hashCode(); Inner.this.hashCode();
@ -78,11 +87,13 @@ public class AnonymousClass {
return o.toString(); return o.toString();
} }
}; };
///#ifndef JAVAC12
Hello blah = new Hello("Hello World") { Hello blah = new Hello("Hello World") {
public void hello() { public void hello() {
System.err.println("overwritten"); System.err.println("overwritten");
} }
}; };
///#endif
Inner blub = new AnonymousClass().new Inner("Inner param") { Inner blub = new AnonymousClass().new Inner("Inner param") {
public void test() { public void test() {
@ -97,7 +108,7 @@ public class AnonymousClass {
} }
Vector v = new Vector(hi.var, new Inner("blah").var) { Vector v = new Vector(hi.var, new Inner("blah").var) {
public String toString() { public String newMethod() {
return super.toString(); return super.toString();
} }
}; };
@ -146,11 +157,13 @@ public class AnonymousClass {
return o.toString(); return o.toString();
} }
}; };
///#ifndef JAVAC12
Hello blah = new Hello("Hello World") { Hello blah = new Hello("Hello World") {
public void hello() { public void hello() {
System.err.println("overwritten"); System.err.println("overwritten");
} }
}; };
///#endif
Inner blub = new Inner("Inner param") { Inner blub = new Inner("Inner param") {
public void test() { public void test() {
@ -165,7 +178,7 @@ public class AnonymousClass {
} }
Vector v = new Vector(hi.var, new Inner("blah").var) { Vector v = new Vector(hi.var, new Inner("blah").var) {
public String toString() { public String newMethod() {
return super.toString(); return super.toString();
} }
}; };

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
import java.util.Vector; import java.util.Vector;

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class ArrayCloneTest { public class ArrayCloneTest {

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
import java.io.*; import java.io.*;
import java.lang.reflect.*; import java.lang.reflect.*;

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class AssignOp { public class AssignOp {
static short static_short; static short static_short;

@ -1,4 +1,4 @@
.class public jode/test/Base .class public Base
.super java/lang/Object .super java/lang/Object
.field public static test I .field public static test I

@ -1,5 +1,5 @@
.class public jode/test/Child .class public Child
.super jode/test/Base .super Base
.field private test I .field private test I
@ -7,17 +7,17 @@
.limit locals 1 .limit locals 1
.limit stack 2 .limit stack 2
aload_0 aload_0
invokespecial jode/test/Base/<init>()V invokespecial Base/<init>()V
getstatic jode/test/Base/test I getstatic Base/test I
pop pop
aload_0 aload_0
getfield jode/test/Base/test J getfield Base/test J
pop2 pop2
aload_0 aload_0
getfield jode/test/Child/test I getfield Child/test I
pop pop
aload_0 aload_0
getfield jode/test/Child/test J getfield Child/test J
pop2 pop2
return return
.end method .end method

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class ClassOpTest { public class ClassOpTest {
static void test1() { static void test1() {

@ -1,112 +0,0 @@
/* Conflicts Copyright (C) 1999 Jochen Hoenicke.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
package jode.test;
/**
* This class tests name conflicts and their resolvation. Note that every
* name in this file should be the shortest possible name.
*/
public class Conflicts
{
int Conflicts;
class Blah
{
Conflicts Inner;
void Conflicts() {
Inner = jode.test.Conflicts.this;
}
}
class Inner
{
int Conflicts;
Conflicts Inner;
class Blah
extends Conflicts.Blah
{
int Blah;
void Inner() {
this.Inner.Inner();
// jode.test.Conflicts.Inner.this.Inner.Inner();
this.Conflicts();
// jode.test.Conflicts.Inner.this.Conflicts();
}
Blah() {
/* empty */
}
Blah(Conflicts Conflicts) {
Conflicts.super();
}
}
void Conflicts() {
int Conflicts = 4;
Conflicts();
new Object() {
void Inner() {
jode.test.Conflicts.this.Inner();
}
};
this.Conflicts = Conflicts;
Inner();
jode.test.Conflicts.this.Conflicts = this.Conflicts;
}
Conflicts Conflicts(Inner Conflicts) {
// Conflicts.this$0.Conflicts = 9;
return jode.test.Conflicts.this;
}
}
class Second
extends Conflicts.Inner.Blah
{
Inner Blah = new Inner();
class Inner extends Conflicts.Inner
{
}
Conflicts.Inner create() {
return jode.test.Conflicts.this.new Inner();
}
Second(Conflicts.Inner Blah) {
Blah.super();
}
}
public void Inner() {
/* empty */
}
public Conflicts() {
int Conflicts = this.Conflicts;
Inner Inner = new Inner();
Inner.Conflicts = 5;
new Inner().Conflicts(Inner).Inner();
}
}

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class ConstantTypes { public class ConstantTypes {
static boolean bool = true; static boolean bool = true;

@ -1,7 +1,7 @@
; This class converts between boolean and ints without type casts. ; This class converts between boolean and ints without type casts.
; You can't decompile this directly, the decompiler probably gives type errors. ; You can't decompile this directly, the decompiler probably gives type errors.
.class public jode/test/EvilTypes .class public EvilTypes
.super java/lang/Object .super java/lang/Object
.field public static runner Ljava/lang/Runnable; .field public static runner Ljava/lang/Runnable;
@ -33,7 +33,7 @@
.limit locals 2 .limit locals 2
.limit stack 2 .limit stack 2
iconst_1 iconst_1
invokestatic jode/test/EvilTypes/intToBool(I)Z invokestatic EvilTypes/intToBool(I)Z
istore 0 istore 0
iconst_2 iconst_2
istore 1 istore 1
@ -67,7 +67,7 @@ second:
done: done:
dup dup
astore_2 astore_2
invokestatic jode/test/EvilTypes/useSerial(Ljava/io/Serializable;)V invokestatic EvilTypes/useSerial(Ljava/io/Serializable;)V
aload_2 aload_2
areturn areturn
.end method .end method
@ -115,9 +115,9 @@ loop:
aload_0 aload_0
iconst_0 iconst_0
aaload aaload
invokestatic jode/test/EvilTypes/test(Ljava/lang/String;)Ljava/lang/Runnable; invokestatic EvilTypes/test(Ljava/lang/String;)Ljava/lang/Runnable;
putstatic jode/test/EvilTypes/runner Ljava/lang/Runnable; putstatic EvilTypes/runner Ljava/lang/Runnable;
getstatic jode/test/EvilTypes/runner Ljava/lang/Runnable; getstatic EvilTypes/runner Ljava/lang/Runnable;
invokeinterface java/lang/Runnable/run()V 1 invokeinterface java/lang/Runnable/run()V 1
return return
.end method .end method

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class Expressions { public class Expressions {
double cd; double cd;
float cf; float cf;

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public abstract class Flow { public abstract class Flow {
int g; int g;

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class For { public class For {

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
/** /**
* The primitive types can give some headaches. You almost never can say * The primitive types can give some headaches. You almost never can say

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class IfCombine { public class IfCombine {
boolean a,b,c; boolean a,b,c;

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
/** /**
* Check if inlines are allowed over package borders. You should put it * Check if inlines are allowed over package borders. You should put it

@ -1,4 +1,3 @@
package jode.test;
public class InlinedAnon { public class InlinedAnon {

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class InnerClass public class InnerClass
{ {

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class InnerCompat { public class InnerCompat {
int x; int x;

@ -1,4 +1,3 @@
package jode.test;
/** /**
* This class shows a bug in javac 1.2-pre2 compiler. * This class shows a bug in javac 1.2-pre2 compiler.

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
class A { class A {
} }

@ -0,0 +1,6 @@
JAVA = @JAVA@
JAVAC = @JAVAC@
JFLAGS =
TESTS_ENVIRONMENT=JAVA=$(JAVA) JAVAC=$(JAVAC) JFLAGS=$(JFLAGS) srcdir=$(srcdir) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir)
TESTS = simpletests.sh

@ -1,4 +1,3 @@
package jode.test;
public class NestedAnon { public class NestedAnon {
public NestedAnon(int maxdepth) { public NestedAnon(int maxdepth) {

@ -2,7 +2,7 @@
; string obfuscating method. Maybe I will use it in the Obfuscator ; string obfuscating method. Maybe I will use it in the Obfuscator
; some day, but probably the decompiler will handle those string, too. ; some day, but probably the decompiler will handle those string, too.
.class public jode/test/ObfuscateStrings .class public ObfuscateStrings
.super java/lang/Object .super java/lang/Object
.method private static obf(Ljava/lang/String;)Ljava/lang/String; .method private static obf(Ljava/lang/String;)Ljava/lang/String;

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class OptimizeTest { public class OptimizeTest {
@ -63,13 +62,13 @@ public class OptimizeTest {
System.err.println("result: "+(g++ + sideInline(g) + g++) + "g: "+g); System.err.println("result: "+(g++ + sideInline(g) + g++) + "g: "+g);
longInline("Hallo", 3); longInline("Hallo", 3);
System.err.println("result:"+ System.err.println("result:"+
(g++ + jode.test.InlineTest (g++ + InlineTest
.difficultSideInline(this, g) .difficultSideInline(this, g)
+ g++) + "g: "+g); + g++) + "g: "+g);
// This was a check which methods are inlined. The result: // This was a check which methods are inlined. The result:
// Only methods in the same package or in sub packages. // Only methods in the same package or in sub packages.
// System.err.println("result:"+ // System.err.println("result:"+
// (g++ + jode.test.inline.InlineTest // (g++ + inline.InlineTest
// .difficultSideInline(this, g) // .difficultSideInline(this, g)
// + g++) + "g: "+g); // + g++) + "g: "+g);
// System.err.println("result:"+ // System.err.println("result:"+

@ -5,7 +5,6 @@
* java jode.Obfuscator --dest tmp.zip --preserve 'jode.test.OptimizerTest.test.(*)*' jode * java jode.Obfuscator --dest tmp.zip --preserve 'jode.test.OptimizerTest.test.(*)*' jode
* </pre> * </pre>
*/ */
package jode.test;
public class OptimizerTest { public class OptimizerTest {
String blah, blub; String blah, blub;

@ -0,0 +1,112 @@
/* Conflicts Copyright (C) 1999 Jochen Hoenicke.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
/**
* This class tests name conflicts and their resolvation. Note that every
* name in this file should be the shortest possible name.
*/
public class ResolveConflicts
{
public class Conflicts
{
int Conflicts;
class Blah
{
Conflicts Inner;
void Conflicts() {
Inner = ResolveConflicts.Conflicts.this;
}
}
class Inner
{
int Conflicts;
Conflicts Inner;
class Blah
extends Conflicts.Blah
{
int Blah;
void Inner() {
this.Inner.Inner();
ResolveConflicts.Conflicts.Inner.this.Inner.Inner();
this.Conflicts();
ResolveConflicts.Conflicts.Inner.this.Conflicts();
}
Blah() {
/* empty */
}
Blah(Conflicts Conflicts) {
Conflicts.super();
}
}
void Conflicts() {
int Conflicts = 4;
Conflicts();
new Object() {
void Inner() {
ResolveConflicts.Conflicts.this.Inner();
}
};
this.Conflicts = Conflicts;
Inner();
ResolveConflicts.Conflicts.this.Conflicts = this.Conflicts;
}
Conflicts Conflicts(Inner Conflicts) {
return ResolveConflicts.Conflicts.this;
}
}
class Second
extends Conflicts.Inner.Blah
{
Inner Blah = new Inner();
class Inner extends Conflicts.Inner
{
}
Conflicts.Inner create() {
return ResolveConflicts.Conflicts.this.new Inner();
}
Second(Conflicts.Inner Blah) {
Blah.super();
}
}
public void Inner() {
/* empty */
}
public Conflicts() {
int Conflicts = this.Conflicts;
Inner Inner = new Inner();
Inner.Conflicts = 5;
new Inner().Conflicts(Inner).Inner();
}
}
}

@ -1,7 +1,7 @@
; This class contains evil stack operations, that make it very hard to ; This class contains evil stack operations, that make it very hard to
; produce correct code. ; produce correct code.
.class public jode/test/StackOps .class public StackOps
.super java/lang/Object .super java/lang/Object
.method public static concatSwaped(ZLjava/lang/String;Ljava/lang/String;)Ljava/lang/String; .method public static concatSwaped(ZLjava/lang/String;Ljava/lang/String;)Ljava/lang/String;

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
public class TriadicExpr { public class TriadicExpr {
int a,b,c,d,e,f,g,h,i,j; int a,b,c,d,e,f,g,h,i,j;

@ -17,7 +17,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
/** /**
* This tests everything that has to do with a ExceptionHandler, that * This tests everything that has to do with a ExceptionHandler, that
@ -120,7 +119,7 @@ class TryCatch {
synchronized (local) { synchronized (local) {
local.foo(); local.foo();
} }
if (true) { if (simple() == 0) {
synchronized (this) { synchronized (this) {
try { try {
System.err.println(); System.err.println();

@ -3,7 +3,6 @@
* $Id$ * $Id$
*/ */
package jode.test;
/* A test class submitted by dave@onekiwi.demon.co.uk */ /* A test class submitted by dave@onekiwi.demon.co.uk */
class Unreach class Unreach

@ -0,0 +1,66 @@
#!/bin/sh
TEMP=`mktemp -d tmp.XXXXXX`
if echo $JAVAC | grep jikes >/dev/null; then
compiler=JIKES;
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/'`
else
compiler=UNKNOWN
fi
echo "detected compiler $compiler"
error=""
EXPECT_FAIL="ResolveConflicts.java AnonymousClass.java InnerClass.java"
for testclass in \
ArrayCloneTest.java \
ArrayTest.java \
AssignOp.java \
ClassOpTest.java \
ConstantTypes.java \
Expressions.java \
Flow.java \
For.java \
HintTypeTest.java \
IfCombine.java \
LocalTypes.java \
ResolveConflicts.java \
TriadicExpr.java \
TryCatch.java \
Unreach.java \
AnonymousClass.java \
InnerClass.java \
InnerCompat.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
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
if ! echo $EXPECT_FAIL | grep $testclass >/dev/null ; then
error="$error $testclass";
echo "FAIL: $testclass"
else
echo "EXPECTED FAIL: $testclass"
fi
else
echo "PASS: $testclass"
rm $testclass.log
fi
#rm -rf $TEMP/*
done
rm -rf $TEMP;
if [ -n "$error" ]; then
exit 1;
fi
Loading…
Cancel
Save