[kaffe] CVS kaffe-extras (guilhem): KJC fix for private inner classes.

Kaffe CVS cvs-commits at kaffe.org
Sat May 22 09:37:10 PDT 2004


PatchSet 34 
Date: 2004/05/22 16:36:23
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
KJC fix for private inner classes.

        * kjc/JClassDeclaration.java: modifier of the default constructor
        for inner classes must never be private (because in that case we will
        not be able to construct it). If it is an inner class we use the
        default constructor.

Members: 
	patches/kjc-kaffe.diff:1.1->1.2 

Index: kaffe-extras/patches/kjc-kaffe.diff
diff -u kaffe-extras/patches/kjc-kaffe.diff:1.1 kaffe-extras/patches/kjc-kaffe.diff:1.2
--- kaffe-extras/patches/kjc-kaffe.diff:1.1	Sat Apr 10 16:15:47 2004
+++ kaffe-extras/patches/kjc-kaffe.diff	Sat May 22 16:36:23 2004
@@ -1,3 +1,15 @@
+diff -N ChangeLog
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ ChangeLog	22 May 2004 11:32:18 -0000	1.1
+@@ -0,0 +1,8 @@
++2004-05-22  Guilhem Lavaux <guilhem at kaffe.org>
++	
++	* ChangeLog: new file.
++
++	* kjc/JClassDeclaration.java: modifier of the default constructor
++	for inner classes must never be private (because in that case we will
++	not be able to construct it). If it is an inner class we use the
++	default constructor.
 diff -u -r1.1.1.1 -r1.2
 --- assertion/PreconditionError.java	6 Apr 2004 16:59:30 -0000	1.1.1.1
 +++ assertion/PreconditionError.java	10 Apr 2004 10:28:29 -0000	1.2
@@ -803,7 +815,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +package at.dms.ksm;
@@ -914,7 +926,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +// Import the necessary classes
@@ -2387,7 +2399,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +package at.dms.ksm;
@@ -4607,7 +4619,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +package at.dms.ksm
@@ -4759,7 +4771,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +prefix Ksm
@@ -8005,7 +8017,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +package at.dms.ksm;
@@ -8092,7 +8104,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +package at.dms.ksm;
@@ -8284,7 +8296,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +package at.dms.ksm;
@@ -8393,7 +8405,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +package at.dms.ksm;
@@ -8459,7 +8471,7 @@
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + *
-+ * $Id: kjc-kaffe.diff,v 1.1 2004/04/10 16:15:47 guilhem Exp $
++ * $Id: kjc-kaffe.diff,v 1.2 2004/05/22 16:36:23 guilhem Exp $
 + */
 +
 +aaload ......... :
@@ -34345,9 +34357,9 @@
    }
  
    // ----------------------------------------------------------------------
-diff -u -r1.1.1.1 -r1.4
+diff -u -r1.1.1.1 -r1.5
 --- kjc/JClassDeclaration.java	6 Apr 2004 16:59:23 -0000	1.1.1.1
-+++ kjc/JClassDeclaration.java	10 Apr 2004 10:28:44 -0000	1.4
++++ kjc/JClassDeclaration.java	22 May 2004 11:32:18 -0000	1.5
 @@ -114,13 +114,13 @@
  
        check(context, 
@@ -34411,7 +34423,21 @@
    }
  
    /**
-@@ -674,7 +677,8 @@
+@@ -650,7 +653,12 @@
+     } else if (owner.isPrivate()) {
+       /* JLS 8.8.7 : If the class is declared private, then the default constructor is 
+          implicitly given the access modifier private (§6.6);*/
+-      modifier = ACC_PRIVATE;
++      /* We will make here an exception if this is an inner class.
++       * In that case we chose to use the default modifier. */
++      if (owner.getOwner() == null)
++        modifier = ACC_PRIVATE;
++      else
++	modifier = 0;
+     } else {
+       /* JLS 8.8.7 : otherwise, the default constructor has the default 
+          access implied by no  access modifier. */
+@@ -674,7 +682,8 @@
     * Collects all initializers and builds a single method.
     * @param	isStatic	class or instance initializers ?
     */
@@ -34421,7 +34447,7 @@
      ArrayList		elems = new ArrayList();
      boolean		needGen = false;
  
-@@ -684,10 +688,13 @@
+@@ -684,10 +693,13 @@
  	elems.add(body[i]);
  	needGen = true;
        } else {
@@ -34439,7 +34465,7 @@
  	}
        }
      }
-@@ -726,6 +733,8 @@
+@@ -726,6 +738,8 @@
     * @param	p		the visitor
     */
    public void accept(KjcVisitor p) {
@@ -34448,7 +34474,7 @@
      super.accept(p);
  
      p.visitClassDeclaration(this,
-@@ -745,6 +754,8 @@
+@@ -745,6 +759,8 @@
     * @param	p		the printwriter into the code is generated
     */
    public void genInnerJavaCode(KjcPrettyPrinter p) {
@@ -35326,9 +35352,9 @@
      p.visitIfStatement(this, cond, thenClause, elseClause);
    }
  
-diff -u -r1.1.1.1 JInitializerDeclaration.java
+diff -u -r1.1.1.1 -r1.5
 --- kjc/JInitializerDeclaration.java	6 Apr 2004 16:59:20 -0000	1.1.1.1
-+++ kjc/JInitializerDeclaration.java	10 Apr 2004 16:09:45 -0000
++++ kjc/JInitializerDeclaration.java	12 Apr 2004 17:43:44 -0000	1.5
 @@ -20,8 +20,9 @@
  
  package at.dms.kjc;
@@ -35409,9 +35435,9 @@
  	  KjcMessages.INSTANCEOF_BADTYPE, expr.getType(factory), dest);
  
      if (expr.getType(factory).isAssignableTo(context, dest)) {
-diff -u -r1.1.1.1 JInterfaceDeclaration.java
+diff -u -r1.1.1.1 -r1.4
 --- kjc/JInterfaceDeclaration.java	6 Apr 2004 16:59:27 -0000	1.1.1.1
-+++ kjc/JInterfaceDeclaration.java	10 Apr 2004 16:09:45 -0000
++++ kjc/JInterfaceDeclaration.java	12 Apr 2004 17:43:44 -0000	1.4
 @@ -158,19 +158,20 @@
     * Check that initializers are correct
     * @exception	PositionedError	an error with reference to the source file
@@ -35993,9 +36019,9 @@
      p.visitSwitchStatement(this, expr, groups);
    }
  
-diff -u -r1.1.1.1 JSynchronizedStatement.java
+diff -u -r1.1.1.1 -r1.3
 --- kjc/JSynchronizedStatement.java	6 Apr 2004 16:59:24 -0000	1.1.1.1
-+++ kjc/JSynchronizedStatement.java	10 Apr 2004 16:09:45 -0000
++++ kjc/JSynchronizedStatement.java	12 Apr 2004 17:43:44 -0000	1.3
 @@ -103,7 +103,6 @@
     * @param	p		the visitor
     */
@@ -37837,9 +37863,9 @@
                                                                }
  
                                                                public void genLoad(GenerationContext context) {
-diff -u -r1.1.1.1 Main.java
+diff -u -r1.1.1.1 -r1.4
 --- kjc/Main.java	6 Apr 2004 16:59:24 -0000	1.1.1.1
-+++ kjc/Main.java	10 Apr 2004 16:09:45 -0000
++++ kjc/Main.java	12 Apr 2004 17:43:44 -0000	1.4
 @@ -25,6 +25,7 @@
  import java.io.UnsupportedEncodingException;
  import java.io.PrintWriter;




More information about the kaffe mailing list