[pypy-svn] r50726 - in pypy/dist/pypy/translator/jvm: . src/pypy
antocuni at codespeak.net
antocuni at codespeak.net
Thu Jan 17 20:01:14 CET 2008
Author: antocuni
Date: Thu Jan 17 20:01:13 2008
New Revision: 50726
Added:
pypy/dist/pypy/translator/jvm/src/pypy/AbstractMethodException.java
Modified:
pypy/dist/pypy/translator/jvm/node.py
pypy/dist/pypy/translator/jvm/typesystem.py
Log:
(antocuni, arigo)
fix a couple a failing tests
Modified: pypy/dist/pypy/translator/jvm/node.py
==============================================================================
--- pypy/dist/pypy/translator/jvm/node.py (original)
+++ pypy/dist/pypy/translator/jvm/node.py Thu Jan 17 20:01:13 2008
@@ -22,7 +22,7 @@
from pypy.translator.jvm.typesystem import \
JvmGeneratedClassType, jString, jStringArray, jVoid, jThrowable, jInt, \
jObject, JvmType, jStringBuilder, jPyPyInterlink, jCallbackInterfaces, \
- JvmGeneratedInterfaceType, jPyPy
+ JvmGeneratedInterfaceType, jPyPy, jPyPyAbstractMethodException
from pypy.translator.jvm.opcodes import \
opcodes
from pypy.translator.jvm.option import \
@@ -687,7 +687,6 @@
"""
JvmGeneratedClassType.__init__(self, name)
self.rendered = False # has rendering occurred?
- self.abstract = False # is this an abstract class?
self.fields = {} # maps field name to jvmgen.Field object
self.interfaces = [] # list of JvmTypes
self.methods = {} # maps method name to a Function object*
@@ -744,12 +743,11 @@
""" Adds an abstract method to our list of methods; jmethod should
be a jvmgen.Method object """
assert jmethod.method_name not in self.methods
- self.abstract = True
self.abstract_methods[jmethod.method_name] = jmethod
def render(self, gen):
self.rendered = True
- gen.begin_class(self, self.super_class, abstract=self.abstract)
+ gen.begin_class(self, self.super_class)
for inter in self.interfaces:
gen.implements(inter)
@@ -772,7 +770,9 @@
method.render(gen)
for method in self.abstract_methods.values():
- gen.begin_j_function(self, method, abstract=True)
+ gen.begin_j_function(self, method)
+ gen.new_with_jtype(jPyPyAbstractMethodException)
+ gen.throw()
gen.end_function()
gen.end_class()
Added: pypy/dist/pypy/translator/jvm/src/pypy/AbstractMethodException.java
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/jvm/src/pypy/AbstractMethodException.java Thu Jan 17 20:01:13 2008
@@ -0,0 +1,8 @@
+package pypy;
+
+public class AbstractMethodException extends Exception {
+
+ public AbstractMethodException(){
+ super("Cannot call RPython abstract methods");
+ }
+}
Modified: pypy/dist/pypy/translator/jvm/typesystem.py
==============================================================================
--- pypy/dist/pypy/translator/jvm/typesystem.py (original)
+++ pypy/dist/pypy/translator/jvm/typesystem.py Thu Jan 17 20:01:13 2008
@@ -199,6 +199,7 @@
jPyPyRecordStringString = JvmClassType('pypy.RecordStringString')
jPyPyRecordFloatSigned = JvmClassType('pypy.RecordFloatSigned')
jPyPyRecordFloatFloat = JvmClassType('pypy.RecordFloatFloat')
+jPyPyAbstractMethodException = JvmClassType('pypy.AbstractMethodException')
jArithmeticException = JvmClassType('java.lang.ArithmeticException', throwable=True)
More information about the pypy-svn
mailing list