--- kopi-2.1B.orig/src/bytecode/classfile/ClassInfo.java 2002-07-15 20:53:29.000000000 +0200 +++ kopi-2.1B.new/src/bytecode/classfile/ClassInfo.java 2003-07-31 10:05:18.000000000 +0200 @@ -44,6 +44,8 @@ // CONSTRUCTORS // -------------------------------------------------------------------- + private String sourceDir; + /** * Constructs a class info structure. * @@ -64,6 +66,7 @@ FieldInfo[] fields, MethodInfo[] methods, InnerClassInfo[] innerClasses, + String sourceDir, String sourceFile, String genericSignature, boolean deprecated, @@ -81,7 +84,11 @@ this.fields = fields; this.methods = methods; this.interfaces = interfaces; - + if (sourceDir == null || sourceDir.equals("")) + this.sourceDir = "."; + else + this.sourceDir = sourceDir; + this.attributes = new AttributeList(innerClasses != null ? new InnerClassTable(innerClasses) : null, sourceFile != null ? new SourceFileAttribute(sourceFile) : null, genericSignature != null ? new SignatureAttribute(genericSignature) : null, @@ -111,6 +118,7 @@ Vector fields, Vector methods, InnerClassInfo[] innerClasses, + String sourceDir, String sourceFile, String genericSignature, boolean deprecated, @@ -123,6 +131,7 @@ (FieldInfo[])Utils.toArray(fields, FieldInfo.class), (MethodInfo[])Utils.toArray(methods, MethodInfo.class), innerClasses, + sourceDir, sourceFile, genericSignature, deprecated, @@ -444,13 +453,14 @@ // if (destination != null && destination != "") { // if (classPath[0] != null && classPath[0] != "") { if (destination == null || destination.equals("")) { - destination = "."; - } - + destination = sourceDir; + } else { + if (classPath[0] != null && !classPath[0].equals("")) { // the class is part of a package destination += File.separator + classPath[0].replace('/', File.separatorChar); } + } // check that destination exists or else create it File destDir = new File(destination); --- kopi-2.1B.orig/src/kjc/CSourceClass.java 2002-07-15 20:53:32.000000000 +0200 +++ kopi-2.1B.new/src/kjc/CSourceClass.java 2003-07-31 09:48:32.000000000 +0200 @@ -416,7 +416,7 @@ { decl = null; // garbage String[] classPath = Utils.splitQualifiedName(getSourceFile(), File.separatorChar); - + try { ClassInfo classInfo = new ClassInfo((short)(getModifiers() & (~ACC_STATIC)), getQualifiedName(), @@ -425,6 +425,7 @@ genFields(factory), genMethods(optimizer, factory), genInnerClasses(), + classPath[0], classPath[1], getSuperClass() == null ? null : getGenericSignature(), isDeprecated(),