[kaffe] CVS kaffe-extras (guilhem): Downgraded to jikes-1.18 (jikes-1.19 fails to compile kjc).

Kaffe CVS cvs-commits at kaffe.org
Sat Apr 10 09:16:02 PDT 2004


PatchSet 33 
Date: 2004/04/10 16:15:46
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Downgraded to jikes-1.18 (jikes-1.19 fails to compile kjc).
Removed old patches and replaced them by a patch against current kopi's cvs merged with our own patches.
Added a script to filter the diff given by 'cvs diff': it contains incorrect $Id$ differences.

Members: 
	build.xml:1.17->1.18 
	patches/kjc-class-file-dir.diff:1.3->1.4(DEAD) 
	patches/kjc-initializers.diff:1.2->1.3(DEAD) 
	patches/kjc-inner-access.diff:1.1->1.2(DEAD) 
	patches/kjc-kaffe.diff:INITIAL->1.1 
	patches/kjc-method-access-nested.diff:1.2->1.3(DEAD) 
	patches/kjc-method-call.diff:1.4->1.5(DEAD) 
	patches/kjc-nested-class-loading.diff:1.1->1.2(DEAD) 
	patches/kjc-parser-ClassnameDotThis.diff:1.1->1.2(DEAD) 
	patches/kjc-static-init.diff:1.1->1.2(DEAD) 
	patches/kjc-string-concat-to-null.diff:1.1->1.2(DEAD) 
	patches/kjc-variable-propagation.diff:1.4->1.5(DEAD) 
	scripts/RemoveId.awk:INITIAL->1.1 

Index: kaffe-extras/build.xml
diff -u kaffe-extras/build.xml:1.17 kaffe-extras/build.xml:1.18
--- kaffe-extras/build.xml:1.17	Sat Mar 27 08:08:54 2004
+++ kaffe-extras/build.xml	Sat Apr 10 16:15:46 2004
@@ -24,7 +24,7 @@
 
   <!-- Jikes -->
 
-  <property name="jikes_ver" value="jikes-1.19"/>
+  <property name="jikes_ver" value="jikes-1.18"/>
   <property name="jikes_dir" location="${build_dir}/${jikes_ver}"/>
   <property name="jikes_tarball" value="${jikes_ver}.tar.bz2"/>
   <property name="jikes_unpacked_stamp" location="${timestamps_dir}/jikes-unpacked.stamp"/>
@@ -49,7 +49,7 @@
 	<exec executable="wget"
 		dir="${tarballs_dir}"
 		failonerror="true">
-		<arg line="ftp://www-126.ibm.com/pub/jikes/1.19/jikes-1.19.tar.bz2"/>
+		<arg line="ftp://www-126.ibm.com/pub/jikes/1.18/jikes-1.18.tar.bz2"/>
 	</exec>
   </target>
 
@@ -233,36 +233,9 @@
 	<move todir="${kjcsuite_dir}">
 		<fileset dir="${build_dir}/${kopi_ver}"/>
 	</move>
-	<patch patchfile="${patches_dir}/kjc-variable-propagation.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-method-access-nested.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-class-file-dir.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-nested-class-loading.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-method-call.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-inner-access.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-string-concat-to-null.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-parser-ClassnameDotThis.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-static-init.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
-	<patch patchfile="${patches_dir}/kjc-initializers.diff"
-		strip="1"
-		dir="${kjcsuite_dir}"/>
+	<patch patchfile="${patches_dir}/kjc-kaffe.diff"
+		strip="0"
+		dir="${kjcsuite_dir}/src"/>
 	<touch file="${kjcsuite_unpacked_stamp}"/>
   </target>
 
===================================================================
Checking out kaffe-extras/patches/kjc-class-file-dir.diff
RCS:  /home/cvs/kaffe/kaffe-extras/patches/Attic/kjc-class-file-dir.diff,v
VERS: 1.3
***************
--- kaffe-extras/patches/kjc-class-file-dir.diff	Sat Apr 10 16:15:51 2004
+++ /dev/null	Sun Aug  4 19:57:58 2002
@@ -1,115 +0,0 @@
-This patch modifies kjc so that it defaults to creating the .class files
-in the same directory as the .java file (as opposed to creating it in
-the current directory).
-
-This change makes the behaviour match the behaviour of Sun's javac (which
-the "javac" ant task depends on).  Fixing this enables the Jasper JSP
-engine to work (used by Tomcat and Jetty).
-
-This should be merged upstream.  If the upstream maintainer objects to
-changing the default behaviour, then I think it might make sense to
-add a "javac compatibility mode" that the ant task could use -- but
-that's more work.
-
-Cheers,
-
- - Jim
-
---- 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(),
-diff -ur kjc-suite-2.1B.jim/src/bytecode/ksm/Ksm.g kjc-suite-2.1B/src/bytecode/ksm/Ksm.g
---- kjc-suite-2.1B.jim/src/bytecode/ksm/Ksm.g   2002-07-15 11:53:29.000000000 -0700
-+++ kjc-suite-2.1B/src/bytecode/ksm/Ksm.g       2003-07-26 23:35:30.000000000 -0700
-@@ -152,6 +152,7 @@
- 			   fields,
- 			   methods,
- 			   null, /*!!!inner classes*/
-+			   ".",
- 			   sourceFile,
-                            genSignature, /* generic Signature*/
- 			   deprecated,
-
-
===================================================================
Checking out kaffe-extras/patches/kjc-initializers.diff
RCS:  /home/cvs/kaffe/kaffe-extras/patches/Attic/kjc-initializers.diff,v
VERS: 1.2
***************
--- kaffe-extras/patches/kjc-initializers.diff	Sat Apr 10 16:15:51 2004
+++ /dev/null	Sun Aug  4 19:57:58 2002
@@ -1,952 +0,0 @@
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/CBinaryField.java kjc-suite-2.1B.new/src/kjc/CBinaryField.java
---- kjc-suite-2.1B/src/kjc/CBinaryField.java	2002-07-15 20:53:31.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/CBinaryField.java	2004-02-13 21:23:15.000000000 +0100
-@@ -59,6 +59,7 @@
- 	setValue(createLiteral(factory, getType(), value));
-       }
-     }
-+    setAnalysed(true);
-   }
- 
-   public void checkTypes(CBinaryTypeContext context) throws UnpositionedError {
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/CBodyContext.java kjc-suite-2.1B.new/src/kjc/CBodyContext.java
---- kjc-suite-2.1B/src/kjc/CBodyContext.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/CBodyContext.java	2004-02-13 21:23:15.000000000 +0100
-@@ -55,6 +55,7 @@
-     flowState = parent.flowState;
-     variableInfo = new CVariableInfo(parent.getVariableInfo());
-     fieldInfo = new CVariableInfo(parent.getFieldInfo());
-+    fieldExtInfo = new CVariableExtInfo(parent.getFieldExtInfo());
-     throwables = parent.throwables;
-   }
- 
-@@ -71,6 +72,7 @@
-     flowState = 0;
-     variableInfo = new CVariableInfo(null);
-     fieldInfo = new CVariableInfo(parent.getFieldInfo());
-+    fieldExtInfo = new CVariableExtInfo(null);
-     throwables = parent.getThrowables();
-   }
- 
-@@ -86,6 +88,7 @@
-     variableInfo.createInfo();
-     fieldInfo = new CVariableInfo(source.getFieldInfo());
-     fieldInfo.createInfo();
-+    fieldExtInfo = new CVariableExtInfo(source.getFieldExtInfo());
-     throwables = parent.throwables;
-   }
- 
-@@ -436,6 +439,22 @@
-     return fieldInfo;
-   }
- 
-+  public int getFieldExtInfo(JFieldDeclaration field) {
-+    return fieldExtInfo.getInfo(field);
-+  }
-+  
-+  public CVariableExtInfo getFieldExtInfo() {
-+    return fieldExtInfo;
-+  }
-+
-+  public void setFieldExtInfo(JFieldDeclaration field, int info) {
-+    fieldExtInfo.setInfo(field, info);
-+  }
-+
-+  public void putFieldExtInfo(JFieldDeclaration field, int info) {
-+    fieldExtInfo.putInfo(field, info);
-+  }
-+
-   // ----------------------------------------------------------------------
-   // THROWABLES
-   // ----------------------------------------------------------------------
-@@ -547,5 +566,7 @@
-   private int			flowState;
-   private final CVariableInfo	variableInfo;
-   private final CVariableInfo	fieldInfo;
-+  private final CVariableExtInfo fieldExtInfo;
-+  
-   private Hashtable		throwables;
- }
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/CTryContext.java kjc-suite-2.1B.new/src/kjc/CTryContext.java
---- kjc-suite-2.1B/src/kjc/CTryContext.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/CTryContext.java	2004-02-13 21:23:15.000000000 +0100
-@@ -59,6 +59,13 @@
-   public void close(TokenReference ref) {
-   }
- 
-+  public void restoreThrowables(Hashtable throwables) {
-+    Enumeration elts = throwables.elements();
-+    
-+    while (elts.hasMoreElements())
-+      addThrowable((CThrowableInfo)elts.nextElement());
-+  }
-+
-   // ----------------------------------------------------------------------
-   // ACCESSORS
-   // ----------------------------------------------------------------------
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/CVariableExtInfo.java kjc-suite-2.1B.new/src/kjc/CVariableExtInfo.java
---- kjc-suite-2.1B/src/kjc/CVariableExtInfo.java	1970-01-01 01:00:00.000000000 +0100
-+++ kjc-suite-2.1B.new/src/kjc/CVariableExtInfo.java	2004-02-13 21:23:15.000000000 +0100
-@@ -0,0 +1,65 @@
-+/*
-+ * Copyright (C) 2004 Kaffe.org's developers
-+ *
-+ * 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 of the License, 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; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+package at.dms.kjc;
-+
-+import java.util.Hashtable;
-+import java.util.Enumeration;
-+
-+public class CVariableExtInfo
-+{
-+	public CVariableExtInfo(CVariableExtInfo info)
-+	{
-+		if (info == null)
-+		  infos = new Hashtable();
-+		else {
-+		  if (info.infos == null)
-+		    info.infos = infos = new Hashtable();
-+		  else
-+		    infos = info.infos;
-+		}
-+	}
-+
-+	public final void setInfo(JFieldDeclaration field, int info)
-+	{
-+		infos.put(field, new Integer(EXIST | info));
-+	}
-+
-+	public final int getInfo(JFieldDeclaration field)
-+	{
-+		Integer i = (Integer) infos.get(field);
-+		
-+		if (i == null)
-+	          infos.put(field, i = new Integer(0));
-+		return i.intValue();
-+	}
-+
-+	public final void putInfo(JFieldDeclaration field, int info)
-+	{
-+		setInfo(field, getInfo(field) | info | EXIST);
-+	}
-+
-+	public Enumeration enumerateFields()
-+	{
-+		return (infos != null) ? infos.keys() : null;
-+	}
-+
-+	private Hashtable infos;
-+
-+	public static final int EXIST = 0x01;
-+	public static final int ANALYSED = 0x02;
-+}
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JAddExpression.java kjc-suite-2.1B.new/src/kjc/JAddExpression.java
---- kjc-suite-2.1B/src/kjc/JAddExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JAddExpression.java	2004-02-13 21:23:15.000000000 +0100
-@@ -81,6 +81,8 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
-+
-     check(context, left.getType(factory).getTypeID() != TID_VOID && right.getType(factory).getTypeID() != TID_VOID,
- 	  KjcMessages.ADD_BADTYPE, left.getType(factory), right.getType(factory));
- 
-@@ -93,13 +95,16 @@
-       throw e.addPosition(getTokenReference());
-     }
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     CReferenceType  stringType = context.getTypeFactory().createReferenceType(TypeFactory.RFT_STRING);
- 
-     // programming trick: no conversion for strings here: will be done in code generation
-     if (!type.equals(stringType)) {
-       left = left.convertType(context, type);
-       right = right.convertType(context, type);
--   }
-+    }
- 
-     if (left.isConstant() && right.isConstant()) {
-       if (type.equals(stringType)) {
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JAssignmentExpression.java kjc-suite-2.1B.new/src/kjc/JAssignmentExpression.java
---- kjc-suite-2.1B/src/kjc/JAssignmentExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JAssignmentExpression.java	2004-02-14 13:43:24.000000000 +0100
-@@ -99,6 +99,9 @@
-                                                  context.getEnvironment(), 
-                                                  false, 
-                                                  false));
-+    // Here, we expect it to be true in any case. But we never know.
-+    fully_analysed = right.isFullyAnalysed() && left.isFullyAnalysed();
-+
-     if (right instanceof JTypeNameExpression) {
-       check(context, false, KjcMessages.VAR_UNKNOWN, ((JTypeNameExpression)right).getQualifiedName());
-     }
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JBinaryExpression.java kjc-suite-2.1B.new/src/kjc/JBinaryExpression.java
---- kjc-suite-2.1B/src/kjc/JBinaryExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JBinaryExpression.java	2004-02-13 21:58:46.000000000 +0100
-@@ -46,6 +46,7 @@
-     super(where);
-     this.left = left;
-     this.right = right;
-+    this.fully_analysed = false;
-   }
- 
-   // ----------------------------------------------------------------------
-@@ -59,6 +60,20 @@
-     return type;
-   }
- 
-+  /**
-+   * @return true is the expression has been completely initialized.
-+   */
-+  public boolean isFullyAnalysed() {
-+    return fully_analysed;
-+  }
-+
-+  /**
-+   * @return true if the expression depends on the specified field.
-+   */
-+  public boolean dependsOnField(CField field) {
-+    return left.dependsOnField(field) || right.dependsOnField(field);
-+  }
-+
-   // ----------------------------------------------------------------------
-   // CODE GENERATION
-   // ----------------------------------------------------------------------
-@@ -120,4 +135,5 @@
-   protected	CType			type;
-   protected	JExpression		left;
-   protected	JExpression		right;
-+  protected	boolean			fully_analysed;
- }
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JBitwiseComplementExpression.java kjc-suite-2.1B.new/src/kjc/JBitwiseComplementExpression.java
---- kjc-suite-2.1B/src/kjc/JBitwiseComplementExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JBitwiseComplementExpression.java	2004-02-13 21:52:07.000000000 +0100
-@@ -62,7 +62,11 @@
- 
-     expr = expr.analyse(context);
-     check(context, expr.getType(factory).isOrdinal(), KjcMessages.UNARY_BADTYPE_BNOT, expr.getType(factory));
-+
-     type = CNumericType.unaryPromote(context, expr.getType(factory));
-+    if (!expr.isFullyAnalysed())
-+      return this;
-+
-     expr = expr.convertType(context, type);
- 
-     if (expr.isConstant()) {
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JBitwiseExpression.java kjc-suite-2.1B.new/src/kjc/JBitwiseExpression.java
---- kjc-suite-2.1B/src/kjc/JBitwiseExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JBitwiseExpression.java	2004-02-14 13:25:49.000000000 +0100
-@@ -67,6 +67,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     try {
-       type = computeType(context, left.getType(factory), right.getType(factory));
-@@ -74,6 +75,9 @@
-       throw e.addPosition(getTokenReference());
-     }
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     left = left.convertType(context, type);
-     right = right.convertType(context, type);
- 
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JClassDeclaration.java kjc-suite-2.1B.new/src/kjc/JClassDeclaration.java
---- kjc-suite-2.1B/src/kjc/JClassDeclaration.java	2004-02-14 13:55:21.000000000 +0100
-+++ kjc-suite-2.1B.new/src/kjc/JClassDeclaration.java	2004-02-13 21:23:15.000000000 +0100
-@@ -378,7 +378,7 @@
-    * Check that initializers are correct
-    * @exception	PositionedError	an error with reference to the source file
-    */
--  public void checkInitializers(CContext context) throws PositionedError {
-+  public boolean checkInitializers(CContext context) throws PositionedError {
-     self = new CClassContext(context, context.getEnvironment(), sourceClass, this);
- 
-     if (assertMethod != null) {
-@@ -386,21 +386,23 @@
-       assertMethod.checkBody1(self);
-     }
- 
--    compileStaticInitializer(self);
-+    boolean good = true; 
-+    good &= compileStaticInitializer(self);
- 
-     // Check inners
-     for (int i = inners.length - 1; i >= 0 ; i--) {
--      inners[i].checkInitializers(self);
-+      good &= inners[i].checkInitializers(self);
-     }
- 
--    super.checkInitializers(context);
-+    return good & super.checkInitializers(context);
-   }
- 
--  public void compileStaticInitializer(CClassContext context)
-+  public boolean compileStaticInitializer(CClassContext context)
-     throws PositionedError
-   {
-     if (statInit != null) {
--      statInit.checkInitializer(context);
-+      if (!statInit.checkInitializer(context))
-+	return false;
- 
-       // check that all final class fields are initialized
-       CField[]	classFields = context.getCClass().getFields();
-@@ -421,6 +423,7 @@
-       // mark all static fields initialized
-       self.markAllFieldToInitialized(true);
-     }
-+    return true;
-   }
- 
-   /**
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JCompilationUnit.java kjc-suite-2.1B.new/src/kjc/JCompilationUnit.java
---- kjc-suite-2.1B/src/kjc/JCompilationUnit.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JCompilationUnit.java	2004-02-13 21:23:15.000000000 +0100
-@@ -220,12 +220,14 @@
-    * @return	true iff sub tree is correct enought to check code
-    * @exception	PositionedError	an error with reference to the source file
-    */
--  public void checkInitializers(Compiler compiler, Vector classes) throws PositionedError {
-+  public boolean checkInitializers(Compiler compiler, Vector classes) throws PositionedError {
-     CCompilationUnitContext	context = new CCompilationUnitContext(compiler, environment, export, classes);
-+    boolean good = true;
- 
-     for (int i = 0; i < typeDeclarations.length ; i++) {
--      typeDeclarations[i].checkInitializers(context);
-+      good &= typeDeclarations[i].checkInitializers(context);
-     }
-+    return good;
-   }
- 
-   // ----------------------------------------------------------------------
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JCompoundAssignmentExpression.java kjc-suite-2.1B.new/src/kjc/JCompoundAssignmentExpression.java
---- kjc-suite-2.1B/src/kjc/JCompoundAssignmentExpression.java	2004-02-14 13:55:21.000000000 +0100
-+++ kjc-suite-2.1B.new/src/kjc/JCompoundAssignmentExpression.java	2004-02-14 13:44:03.000000000 +0100
-@@ -127,6 +127,8 @@
-       check(context, false, KjcMessages.VAR_UNKNOWN, ((JTypeNameExpression)right).getQualifiedName());
-     }
- 
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
-+
-     // JLS 15.26.2 Compound Assignment Operators :
-     // All compound assignment operators require both operands to be of
-     // primitive type, except for +=, which allows the right-hand operand to be
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JConditionalAndExpression.java kjc-suite-2.1B.new/src/kjc/JConditionalAndExpression.java
---- kjc-suite-2.1B/src/kjc/JConditionalAndExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JConditionalAndExpression.java	2004-02-13 21:45:29.000000000 +0100
-@@ -61,6 +61,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     CType	leftType = left.getType(factory);
-     CType	rightType = right.getType(factory);
-@@ -72,6 +73,9 @@
- 
-     type = booleanType;
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     // JLS 15.28: Constant Expression ?
-     if (left.isConstant() && right.isConstant()) {
-       return new JBooleanLiteral(getTokenReference(), left.booleanValue() && right.booleanValue());
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JConditionalOrExpression.java kjc-suite-2.1B.new/src/kjc/JConditionalOrExpression.java
---- kjc-suite-2.1B/src/kjc/JConditionalOrExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JConditionalOrExpression.java	2004-02-13 21:45:39.000000000 +0100
-@@ -61,6 +61,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     CType	leftType = left.getType(factory);
-     CType	rightType = right.getType(factory);
-@@ -72,6 +73,9 @@
- 
-     type = primBoolean;
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     // JLS 15.28: Constant Expression ?
-     if (left.isConstant() && right.isConstant()) {
-       return new JBooleanLiteral(getTokenReference(), left.booleanValue() || right.booleanValue());
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JDivideExpression.java kjc-suite-2.1B.new/src/kjc/JDivideExpression.java
---- kjc-suite-2.1B/src/kjc/JDivideExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JDivideExpression.java	2004-02-13 21:23:15.000000000 +0100
-@@ -63,6 +63,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     try {
-       type = computeType(context, left.getType(factory), right.getType(factory));
-@@ -70,6 +71,9 @@
-       throw e.addPosition(getTokenReference());
-     }
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     if (type.isOrdinal() && right.isConstant() && ((JLiteral)right).isDefault()) {
-       context.reportTrouble(new CWarning(getTokenReference(), KjcMessages.DIVIDE_BY_ZERO_INT));
-     }
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JEqualityExpression.java kjc-suite-2.1B.new/src/kjc/JEqualityExpression.java
---- kjc-suite-2.1B/src/kjc/JEqualityExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JEqualityExpression.java	2004-02-13 21:47:23.000000000 +0100
-@@ -82,8 +82,15 @@
-   public JExpression analyse(CExpressionContext context) throws PositionedError {
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     TypeFactory factory = context.getTypeFactory();
-+
-+    type = factory.getPrimitiveType(TypeFactory.PRM_BOOLEAN);
-+
-+    if (!fully_analysed)
-+      return this;
-+
-     CType	leftType = left.getType(factory);
-     CType	rightType = right.getType(factory);
-     CType       booleanType = factory.getPrimitiveType(TypeFactory.PRM_BOOLEAN);
-@@ -117,8 +124,6 @@
-       }
-     }
- 
--    type = factory.getPrimitiveType(TypeFactory.PRM_BOOLEAN);
--
-     if (left.isConstant() && right.isConstant()) {
-       return constantFolding(factory);
-     } else {
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JExpression.java kjc-suite-2.1B.new/src/kjc/JExpression.java
---- kjc-suite-2.1B/src/kjc/JExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JExpression.java	2004-02-13 21:23:15.000000000 +0100
-@@ -53,6 +53,21 @@
-   public abstract CType getType(TypeFactory factory);
- 
-   /**
-+   * Tests whether the expression is fully analysed or if they are any pending
-+   * expressions to reanalyse (useful for static initializers).
-+   */
-+  public boolean isFullyAnalysed() {
-+    return true;
-+  }
-+
-+  /**
-+   * Tests whether the expression depends on the specified field.
-+   */
-+  public boolean dependsOnField(CField field) {
-+    return false;
-+  }
-+
-+  /**
-    * Tests whether this expression denotes a compile-time constant (JLS 15.28).
-    *
-    * @return	true iff this expression is constant
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JFieldAccessExpression.java kjc-suite-2.1B.new/src/kjc/JFieldAccessExpression.java
---- kjc-suite-2.1B/src/kjc/JFieldAccessExpression.java	2002-07-15 20:53:33.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JFieldAccessExpression.java	2004-02-14 13:29:25.000000000 +0100
-@@ -107,6 +107,12 @@
-     return type;
-   }
- 
-+  public boolean dependsOnField(CField field) {
-+    return this.field == field ||
-+      (this.field.getValue() != null && 
-+       this.field.getValue().dependsOnField(field));
-+  }
-+
-   /**
-    * Tests whether this expression denotes a compile-time constant (JLS 15.28).
-    *
-@@ -119,10 +125,14 @@
-     //   are constant expressions
-     // - Qualified names of the form TypeName . Identifier that refer to
-     //   final variables whose initializers are constant expressions
-+    if (field.getValue() == null)
-+      return false;
- 
-+    if (field.getValue().dependsOnField(field))
-+      return false;
-+    
-     return constantPrefix
-       && field.isFinal()
--      && field.getValue() != null
-       && field.getValue().isConstant();
-   }
- 
-@@ -184,6 +194,10 @@
-     return field;
-   }
- 
-+  public boolean isFullyAnalysed() {
-+    return (!field.isFinal() || field.isAnalysed());
-+  }
-+
-   /**
-    * Returns the literal value of this field.
-    */
-@@ -275,6 +289,9 @@
- 
-     type = field.getType();
- 
-+    if (!field.isAnalysed())
-+      return this;
-+
-     if (isConstant()) {
-       // FIX Type!!
-       return field.getValue();
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JFieldDeclaration.java kjc-suite-2.1B.new/src/kjc/JFieldDeclaration.java
---- kjc-suite-2.1B/src/kjc/JFieldDeclaration.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JFieldDeclaration.java	2004-02-14 13:29:37.000000000 +0100
-@@ -177,7 +177,20 @@
-   public void analyse(CBodyContext context) throws PositionedError {
-     TypeFactory factory = context.getTypeFactory();
- 
-+    // This is special case where a crazy programmer made this variable
-+    // depends on itself. Sun is gen
-+    if (variable.getValue() != null &&
-+	variable.getValue().dependsOnField(getField())) {
-+      ((CSourceField)getField()).setFullyDeclared(true);
-+    }
-+
-     variable.analyse(context);
-+    if (!variable.isDefinitionAnalysed())
-+    {
-+      context.putFieldExtInfo(this, 0);
-+      return;
-+    }
-+
-     // JLS 8.1.2 : Inner classes may inherit static members that 
-     // are not compile-time constants even though they may not declare 
-     // them. Inner classes may not declare static members, unless 
-@@ -211,6 +224,8 @@
-       }
-     }
- 
-+    context.putFieldExtInfo(this, CVariableExtInfo.ANALYSED);
-+
-     if (hasInitializer()) {
-       context.setFieldInfo(((CSourceField)getField()).getPosition(), CVariableInfo.INITIALIZED);
-     }
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JInitializerDeclaration.java kjc-suite-2.1B.new/src/kjc/JInitializerDeclaration.java
---- kjc-suite-2.1B/src/kjc/JInitializerDeclaration.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JInitializerDeclaration.java	2004-02-13 21:23:15.000000000 +0100
-@@ -22,6 +22,7 @@
- 
- import at.dms.compiler.PositionedError;
- import at.dms.compiler.TokenReference;
-+import java.util.Enumeration;
- 
- /**
-  * This class represents a java class in the syntax tree
-@@ -106,7 +107,7 @@
-    * @param	context		the actual context of analyse
-    * @exception	PositionedError		Error catched as soon as possible
-    */
--  public void checkInitializer(CClassContext context) throws PositionedError {
-+  public boolean checkInitializer(CClassContext context) throws PositionedError {
-     if (getMethod().isStatic()) {
-       TokenReference    ref = TokenReference.NO_REF;
-       JBlock            classBlock = null;
-@@ -219,12 +220,23 @@
-       block.addThisVariable();
-     }
-     body.analyse(block);
--      if (! block.isReachable()) {
--	throw new CLineError(getTokenReference(), KjcMessages.STATEMENT_UNREACHABLE);
--      }
-+    boolean completelyInitialized = true;
-+    Enumeration keys = block.getFieldExtInfo().enumerateFields(); 
-+    while (keys.hasMoreElements()) {
-+      JFieldDeclaration field = (JFieldDeclaration)keys.nextElement();
-+      int info = block.getFieldExtInfo().getInfo(field);
-+
-+      if ((info & (CVariableExtInfo.EXIST|CVariableExtInfo.ANALYSED)) == CVariableExtInfo.EXIST)
-+	completelyInitialized = false;
-+    }
-+    if (! block.isReachable()) {
-+      throw new CLineError(getTokenReference(), KjcMessages.STATEMENT_UNREACHABLE);
-+    }
- 
-     block.close(getTokenReference());
-     self.close(getTokenReference());
-+
-+    return completelyInitialized;
-   }
- 
-   // ----------------------------------------------------------------------
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JInterfaceDeclaration.java kjc-suite-2.1B.new/src/kjc/JInterfaceDeclaration.java
---- kjc-suite-2.1B/src/kjc/JInterfaceDeclaration.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JInterfaceDeclaration.java	2004-02-13 21:23:15.000000000 +0100
-@@ -158,19 +158,20 @@
-    * Check that initializers are correct
-    * @exception	PositionedError	an error with reference to the source file
-    */
--  public void checkInitializers(CContext context) throws PositionedError {
-+  public boolean checkInitializers(CContext context) throws PositionedError {
-     //    CInterfaceContext self = new CInterfaceContext(context, context.getEnvironment(), sourceClass, this);
-     self = new CInterfaceContext(context, context.getEnvironment(), sourceClass, this);
-+    boolean good = true; 
-     if (statInit != null) {
--      statInit.checkInitializer(self);
-+      good &= statInit.checkInitializer(self);
-     }
- 
-     // Check inners
-     for (int i = inners.length - 1; i >= 0 ; i--) {
--      inners[i].checkInitializers(self);
-+      good &= inners[i].checkInitializers(self);
-     }
- 
--    super.checkInitializers(context);
-+    return good & super.checkInitializers(context);
-   }
- 
-   /**
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JLogicalComplementExpression.java kjc-suite-2.1B.new/src/kjc/JLogicalComplementExpression.java
---- kjc-suite-2.1B/src/kjc/JLogicalComplementExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JLogicalComplementExpression.java	2004-02-13 21:51:38.000000000 +0100
-@@ -63,6 +63,7 @@
-     expr = expr.analyse(context);
-     check(context, expr.getType(factory) == booleanType, KjcMessages.UNARY_BADTYPE_LNOT, expr.getType(factory));
-     type = booleanType;
-+
-     if (expr.isConstant()) {
-       return new JBooleanLiteral(getTokenReference(), !expr.booleanValue());
-     } else {
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JMinusExpression.java kjc-suite-2.1B.new/src/kjc/JMinusExpression.java
---- kjc-suite-2.1B/src/kjc/JMinusExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JMinusExpression.java	2004-02-13 21:23:15.000000000 +0100
-@@ -62,6 +62,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     try {
-       type = computeType(context, left.getType(factory), right.getType(factory));
-@@ -69,6 +70,9 @@
-       throw e.addPosition(getTokenReference());
-     }
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     left = left.convertType(context, type);
-     right = right.convertType(context, type);
- 
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JModuloExpression.java kjc-suite-2.1B.new/src/kjc/JModuloExpression.java
---- kjc-suite-2.1B/src/kjc/JModuloExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JModuloExpression.java	2004-02-13 21:23:15.000000000 +0100
-@@ -63,6 +63,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     try {
-       type = computeType(context, left.getType(factory), right.getType(factory));
-@@ -70,6 +71,9 @@
-       throw e.addPosition(getTokenReference());
-     }
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     left = left.convertType(context, type);
-     right = right.convertType(context, type);
- 
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JMultExpression.java kjc-suite-2.1B.new/src/kjc/JMultExpression.java
---- kjc-suite-2.1B/src/kjc/JMultExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JMultExpression.java	2004-02-13 21:23:15.000000000 +0100
-@@ -63,6 +63,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     try {
-       type = computeType(context, left.getType(factory), right.getType(factory));
-@@ -70,6 +71,9 @@
-       throw e.addPosition(getTokenReference());
-     }
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     left = left.convertType(context, type);
-     right = right.convertType(context, type);
- 
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JRelationalExpression.java kjc-suite-2.1B.new/src/kjc/JRelationalExpression.java
---- kjc-suite-2.1B/src/kjc/JRelationalExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JRelationalExpression.java	2004-02-13 21:47:37.000000000 +0100
-@@ -66,6 +66,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     check(context,
- 	  left.getType(factory).isNumeric() && right.getType(factory).isNumeric(),
-@@ -73,6 +74,9 @@
- 
-     type = context.getTypeFactory().getPrimitiveType(TypeFactory.PRM_BOOLEAN);
- 
-+    if (!fully_analysed)
-+      return this;
-+
-     CType	promoted = CNumericType.binaryPromote(context, left.getType(factory), right.getType(factory));
-     left = left.convertType(context, promoted);
-     right = right.convertType(context, promoted);
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JReturnStatement.java kjc-suite-2.1B.new/src/kjc/JReturnStatement.java
---- kjc-suite-2.1B/src/kjc/JReturnStatement.java	2002-07-15 20:53:33.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JReturnStatement.java	2004-02-13 21:23:15.000000000 +0100
-@@ -88,7 +88,8 @@
-       check(context,
- 	    expr.isAssignableTo(expressionContext, returnType),
- 	    KjcMessages.RETURN_BADTYPE, expr.getType(factory), returnType);
--      expr = expr.convertType(expressionContext, returnType);
-+      if (expr.isFullyAnalysed())
-+        expr = expr.convertType(expressionContext, returnType);
-     } else {
-       check(context, returnType.getTypeID() == TID_VOID, KjcMessages.RETURN_EMPTY_NONVOID);
-     }
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JShiftExpression.java kjc-suite-2.1B.new/src/kjc/JShiftExpression.java
---- kjc-suite-2.1B/src/kjc/JShiftExpression.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JShiftExpression.java	2004-02-14 13:25:36.000000000 +0100
-@@ -67,6 +67,7 @@
- 
-     left = left.analyse(context);
-     right = right.analyse(context);
-+    fully_analysed = left.isFullyAnalysed() && right.isFullyAnalysed();
- 
-     try {
-       type = computeType(context, left.getType(factory), right.getType(factory));
-@@ -74,6 +75,9 @@
-       throw e.addPosition(getTokenReference());
-     }
- 
-+    if (!fully_analysed)
-+      return this;
-+    
-     left = left.convertType(context, type);
-     right = right.convertType(context, context.getTypeFactory().getPrimitiveType(TypeFactory.PRM_INT));
- 
-diff -N -ur -x KjcParser.java -x KjcScanner.java -x '*~' kjc-suite-2.1B/src/kjc/JTryCatchStatement.java kjc-suite-2.1B.new/src/kjc/JTryCatchStatement.java
---- kjc-suite-2.1B/src/kjc/JTryCatchStatement.java	2002-07-15 20:53:32.000000000 +0200
-+++ kjc-suite-2.1B.new/src/kjc/JTryCatchStatement.java	2004-02-13 21:23:15.000000000 +0100
-@@ -21,6 +21,7 @@
- package at.dms.kjc;
- 
- import java.util.Enumeration;
-+import java.util.Hashtable;
- 
- import at.dms.compiler.PositionedError;
- import at.dms.compiler.CWarning;
-@@ -84,6 +85,12 @@
- 
-     tryContext = new CTryContext(context, context.getEnvironment());
-     tryClause.analyse(tryContext);
-+    if (!analysed) {
-+      saveThrowables = tryContext.getThrowables();
-+      analysed = true;
-+    } else {
-+      tryContext.restoreThrowables(saveThrowables);
-+    }
-     if (tryContext.isReachable()) {
-       self.merge(tryContext);

*** Patch too long, truncated ***




More information about the kaffe mailing list