You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by jason_ni <ja...@gmail.com> on 2011/08/20 09:26:32 UTC

jcc compile a simple java class with errors, "void" java method translation may be incorrect

Hi,

I used jcc to compile a very simple java class and found this error:
-------------------------------------
...
build/_ImJava/__wrap__.cpp: In function ‘PyObject*
idm::fudan::edu::cn::org::t_ImJava_get__total(idm::fudan::edu::cn::org::t_ImJava*,
void*)’:
build/_ImJava/__wrap__.cpp:8412: error: variable or field ‘value’ declared
void
build/_ImJava/__wrap__.cpp:8413: error: ‘value’ was not declared in this
scope
build/_ImJava/__wrap__.cpp:8414: error: ‘t_void’ has not been declared
build/_ImJava/__wrap__.cpp:8414: error: ‘value’ was not declared in this
scope
error: command 'gcc' failed with exit status 1
-------------------------------------
The c++ code translated by jcc:
-------------------------------------
 8410                     static PyObject *t_ImJava_get__total(t_ImJava
*self, void *data)
 8411                     {
 8412                         void value;
 8413                         OBJ_CALL(value = self->object.getTotal());
 8414                         return t_void::wrap_Object(value);
 8415                     }
-------------------------------------
The Java code:
-------------------------------------
	public void getTotal(){
		System.out.println("error here");
	}
-------------------------------------
I have tested that replace "void" with "int" and gave a return value in
"getTotal" then this classs can be compiled without error.
So, I guess it's a bug...  Am I right?

Thanks!
Jason


--
View this message in context: http://pylucene-users-developers-list.2474766.n2.nabble.com/jcc-compile-a-simple-java-class-with-errors-void-java-method-translation-may-be-incorrect-tp6705781p6705781.html
Sent from the PyLucene users & developers list mailing list archive at Nabble.com.

Re: jcc compile a simple java class with errors, "void" java method translation may be incorrect

Posted by Andi Vajda <va...@apache.org>.
  Hi Jason,

On Sat, 20 Aug 2011, jason_ni wrote:

> I used jcc to compile a very simple java class and found this error:
> -------------------------------------
> ...
> build/_ImJava/__wrap__.cpp: In function ?PyObject*
> idm::fudan::edu::cn::org::t_ImJava_get__total(idm::fudan::edu::cn::org::t_ImJava*,
> void*)?:
> build/_ImJava/__wrap__.cpp:8412: error: variable or field ?value? declared
> void
> build/_ImJava/__wrap__.cpp:8413: error: ?value? was not declared in this
> scope
> build/_ImJava/__wrap__.cpp:8414: error: ?t_void? has not been declared
> build/_ImJava/__wrap__.cpp:8414: error: ?value? was not declared in this
> scope
> error: command 'gcc' failed with exit status 1
> -------------------------------------
> The c++ code translated by jcc:
> -------------------------------------
> 8410                     static PyObject *t_ImJava_get__total(t_ImJava
> *self, void *data)
> 8411                     {
> 8412                         void value;
> 8413                         OBJ_CALL(value = self->object.getTotal());
> 8414                         return t_void::wrap_Object(value);
> 8415                     }
> -------------------------------------
> The Java code:
> -------------------------------------
> 	public void getTotal(){
> 		System.out.println("error here");
> 	}
> -------------------------------------
> I have tested that replace "void" with "int" and gave a return value in
> "getTotal" then this classs can be compiled without error.
> So, I guess it's a bug...  Am I right?

Indeed, there was a bug with not checking that the getters for which prop 
methods are generated aren't returning void.

It's now fixed in rev 1159920.

Thank you for the bug report !

Andi..