public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* error: 'jvariant::jvariant(jbyte)' cannot be overloaded
@ 2009-07-16 12:38 Mathieu Malaterre
  2009-07-19  6:02 ` Florian Weimer
  0 siblings, 1 reply; 11+ messages in thread
From: Mathieu Malaterre @ 2009-07-16 12:38 UTC (permalink / raw)
  To: java

Hi there,

  I am trying to compile VTK using gcj and I am getting those compiler
error, could someone please let me know if the code is legal (should
compile) or not:

$ make
...
In file included from
/home/mathieu/Kitware/VTK/Graphics/vtkJavaProgrammableFilter.cxx:25:0:
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:34:3: error:
'jvariant::jvariant(jbyte)' cannot be overloaded
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:33:3: error: with
'jvariant::jvariant(jboolean)'
/home/mathieu/Kitware/VTK/Graphics/vtkJavaProgrammableFilter.cxx: In
member function 'virtual int
vtkJavaProgrammableFilter::FillInputPortInformation(int,
vtkInformation*)':
/home/mathieu/Kitware/VTK/Graphics/vtkJavaProgrammableFilter.cxx:157:159:
error: conversion from 'jvariant' to 'jboolean' is ambiguous
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:52:3: note:
candidates are: jvariant::operator __jstring*() <near match>
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:51:3: note:
        jvariant::operator __jobject*() <near match>
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:50:3: note:
        jvariant::operator jdouble()
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:49:3: note:
        jvariant::operator jfloat()
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:48:3: note:
        jvariant::operator jlong()
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:47:3: note:
        jvariant::operator jint()
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:46:3: note:
        jvariant::operator jshort()
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:45:3: note:
        jvariant::operator jchar()
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:44:3: note:
        jvariant::operator jbyte()
/home/mathieu/Kitware/VTK/Graphics/vtkJVMManager.h:43:3: note:
        jvariant::operator jboolean()


Ref:
http://public.kitware.com/cgi-bin/viewcvs.cgi/Graphics/vtkJVMManager.h?view=markup
http://public.kitware.com/cgi-bin/viewcvs.cgi/Graphics/vtkJavaProgrammableFilter.cxx?view=markup

Thanks,
-- 
Mathieu

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-16 12:38 error: 'jvariant::jvariant(jbyte)' cannot be overloaded Mathieu Malaterre
@ 2009-07-19  6:02 ` Florian Weimer
  2009-07-19  7:52   ` Andrew Haley
  0 siblings, 1 reply; 11+ messages in thread
From: Florian Weimer @ 2009-07-19  6:02 UTC (permalink / raw)
  To: Mathieu Malaterre; +Cc: java

* Mathieu Malaterre:

>   I am trying to compile VTK using gcj and I am getting those compiler
> error, could someone please let me know if the code is legal (should
> compile) or not:

This is legal per Sun's JNI specficiation: jboolean and jbyte are
distinct types because there signedness differs:

<http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp198>

It's a bug in GCC.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-19  6:02 ` Florian Weimer
@ 2009-07-19  7:52   ` Andrew Haley
  2009-07-19  8:17     ` Florian Weimer
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Haley @ 2009-07-19  7:52 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Mathieu Malaterre, java

On 07/19/2009 07:02 AM, Florian Weimer wrote:
> * Mathieu Malaterre:
> 
>>   I am trying to compile VTK using gcj and I am getting those compiler
>> error, could someone please let me know if the code is legal (should
>> compile) or not:
> 
> This is legal per Sun's JNI specficiation: jboolean and jbyte are
> distinct types because there signedness differs:
> 
> <http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp198>
> 
> It's a bug in GCC.

I didn't see the original message to which this is replying.  If you can
make a test case I'll  see if the bug can be fixed.

Andrew.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-19  7:52   ` Andrew Haley
@ 2009-07-19  8:17     ` Florian Weimer
  2009-07-19 15:17       ` Andrew Haley
  0 siblings, 1 reply; 11+ messages in thread
From: Florian Weimer @ 2009-07-19  8:17 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Mathieu Malaterre, java

* Andrew Haley:

> On 07/19/2009 07:02 AM, Florian Weimer wrote:
>> * Mathieu Malaterre:
>> 
>>>   I am trying to compile VTK using gcj and I am getting those compiler
>>> error, could someone please let me know if the code is legal (should
>>> compile) or not:
>> 
>> This is legal per Sun's JNI specficiation: jboolean and jbyte are
>> distinct types because there signedness differs:
>> 
>> <http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp198>
>> 
>> It's a bug in GCC.
>
> I didn't see the original message to which this is replying.

It's about C++ code which contains a function overloaded on jbyte and
jboolean.  This fails with GCJ because they are typedef'ed to the same
type.

> If you can make a test case I'll see if the bug can be fixed.

Compare the table I referenced with these pieces from jni_md.h:

| typedef int    jbyte  __attribute__((__mode__(__QI__)));
| typedef int    jshort __attribute__((__mode__(__HI__)));
| typedef int    jint   __attribute__((__mode__(__SI__)));
| typedef int    jlong  __attribute__((__mode__(__DI__)));
| typedef int    jboolean __attribute__((__mode__(__QI__)));
| typedef unsigned short jchar __attribute__((__mode__(__HI__)));
| typedef float  jfloat;
| typedef double jdouble;
| typedef jint jsize;

| typedef int8_t jbyte;
| typedef int16_t jshort;
| typedef int32_t jint;
| typedef int64_t jlong;
| typedef float jfloat;
| typedef double jdouble;
| typedef jint jsize;
| typedef int8_t jboolean;
| typedef uint16_t jchar;

jboolean is signed, but Sun's spec says it should be unsigned.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-19  8:17     ` Florian Weimer
@ 2009-07-19 15:17       ` Andrew Haley
  2009-07-19 18:53         ` Florian Weimer
  2009-07-21  7:17         ` Mathieu Malaterre
  0 siblings, 2 replies; 11+ messages in thread
From: Andrew Haley @ 2009-07-19 15:17 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Mathieu Malaterre, java

On 07/19/2009 09:17 AM, Florian Weimer wrote:
> * Andrew Haley:
> 
>> On 07/19/2009 07:02 AM, Florian Weimer wrote:
>>> * Mathieu Malaterre:
>>>
>>>>   I am trying to compile VTK using gcj and I am getting those compiler
>>>> error, could someone please let me know if the code is legal (should
>>>> compile) or not:
>>> This is legal per Sun's JNI specficiation: jboolean and jbyte are
>>> distinct types because there signedness differs:
>>>
>>> <http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp198>
>>>
>>> It's a bug in GCC.
>> I didn't see the original message to which this is replying.
> 
> It's about C++ code which contains a function overloaded on jbyte and
> jboolean.  This fails with GCJ because they are typedef'ed to the same
> type.
> 
>> If you can make a test case I'll see if the bug can be fixed.
> 
> Compare the table I referenced with these pieces from jni_md.h:
> 
> | typedef int    jbyte  __attribute__((__mode__(__QI__)));
> | typedef int    jshort __attribute__((__mode__(__HI__)));
> | typedef int    jint   __attribute__((__mode__(__SI__)));
> | typedef int    jlong  __attribute__((__mode__(__DI__)));
> | typedef int    jboolean __attribute__((__mode__(__QI__)));
> | typedef unsigned short jchar __attribute__((__mode__(__HI__)));
> | typedef float  jfloat;
> | typedef double jdouble;
> | typedef jint jsize;
> 
> | typedef int8_t jbyte;
> | typedef int16_t jshort;
> | typedef int32_t jint;
> | typedef int64_t jlong;
> | typedef float jfloat;
> | typedef double jdouble;
> | typedef jint jsize;
> | typedef int8_t jboolean;
> | typedef uint16_t jchar;
> 
> jboolean is signed, but Sun's spec says it should be unsigned.

OK.  I can fix it, but it's an ABI-incompatible change.  There's no
way this fix could be applied to any existing releases, only gcc
4.5.

Andrew.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-19 15:17       ` Andrew Haley
@ 2009-07-19 18:53         ` Florian Weimer
  2009-07-20  8:17           ` Andrew Haley
  2009-07-21  7:17         ` Mathieu Malaterre
  1 sibling, 1 reply; 11+ messages in thread
From: Florian Weimer @ 2009-07-19 18:53 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Mathieu Malaterre, java

* Andrew Haley:

> OK.  I can fix it, but it's an ABI-incompatible change.

Yes, I know.

> There's no way this fix could be applied to any existing releases,
> only gcc 4.5.

Right.  I still think it's a bug which should be fixed.  It's also
easy to pick up GCC's <jni.h> when compiling for OpenJDK, so it's not
just GCJ which is affected by this.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-19 18:53         ` Florian Weimer
@ 2009-07-20  8:17           ` Andrew Haley
  2009-07-20  8:28             ` Florian Weimer
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Haley @ 2009-07-20  8:17 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Mathieu Malaterre, java

On 07/19/2009 07:53 PM, Florian Weimer wrote:
> * Andrew Haley:
> 
>> OK.  I can fix it, but it's an ABI-incompatible change.
> 
> Yes, I know.
> 
>> There's no way this fix could be applied to any existing releases,
>> only gcc 4.5.
> 
> Right.  I still think it's a bug which should be fixed.  It's also
> easy to pick up GCC's <jni.h> when compiling for OpenJDK, so it's not
> just GCJ which is affected by this.

Well, it mostly is, since JNI code is mostly written in C.  I suppose
that's why this has never been noticed before.

Andrew.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-20  8:17           ` Andrew Haley
@ 2009-07-20  8:28             ` Florian Weimer
  0 siblings, 0 replies; 11+ messages in thread
From: Florian Weimer @ 2009-07-20  8:28 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Mathieu Malaterre, java

* Andrew Haley:

>> Right.  I still think it's a bug which should be fixed.  It's also
>> easy to pick up GCC's <jni.h> when compiling for OpenJDK, so it's not
>> just GCJ which is affected by this.
>
> Well, it mostly is, since JNI code is mostly written in C.

Not sure about this.

> I suppose that's why this has never been noticed before.

javah generats an extern "C" wrapper for the prototypes, so you're
still ABI-compatible to the JNI interface even if you use C++.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-19 15:17       ` Andrew Haley
  2009-07-19 18:53         ` Florian Weimer
@ 2009-07-21  7:17         ` Mathieu Malaterre
  2009-07-21  7:49           ` Andrew Haley
  1 sibling, 1 reply; 11+ messages in thread
From: Mathieu Malaterre @ 2009-07-21  7:17 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Florian Weimer, java

On Sun, Jul 19, 2009 at 5:16 PM, Andrew Haley<aph@redhat.com> wrote:
> On 07/19/2009 09:17 AM, Florian Weimer wrote:
>> * Andrew Haley:
>>
>>> On 07/19/2009 07:02 AM, Florian Weimer wrote:
>>>> * Mathieu Malaterre:
>>>>
>>>>>   I am trying to compile VTK using gcj and I am getting those compiler
>>>>> error, could someone please let me know if the code is legal (should
>>>>> compile) or not:
>>>> This is legal per Sun's JNI specficiation: jboolean and jbyte are
>>>> distinct types because there signedness differs:
>>>>
>>>> <http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp198>
>>>>
>>>> It's a bug in GCC.
>>> I didn't see the original message to which this is replying.
>>
>> It's about C++ code which contains a function overloaded on jbyte and
>> jboolean.  This fails with GCJ because they are typedef'ed to the same
>> type.
>>
>>> If you can make a test case I'll see if the bug can be fixed.
>>
>> Compare the table I referenced with these pieces from jni_md.h:
>>
>> | typedef int    jbyte  __attribute__((__mode__(__QI__)));
>> | typedef int    jshort __attribute__((__mode__(__HI__)));
>> | typedef int    jint   __attribute__((__mode__(__SI__)));
>> | typedef int    jlong  __attribute__((__mode__(__DI__)));
>> | typedef int    jboolean __attribute__((__mode__(__QI__)));
>> | typedef unsigned short jchar __attribute__((__mode__(__HI__)));
>> | typedef float  jfloat;
>> | typedef double jdouble;
>> | typedef jint jsize;
>>
>> | typedef int8_t jbyte;
>> | typedef int16_t jshort;
>> | typedef int32_t jint;
>> | typedef int64_t jlong;
>> | typedef float jfloat;
>> | typedef double jdouble;
>> | typedef jint jsize;
>> | typedef int8_t jboolean;
>> | typedef uint16_t jchar;
>>
>> jboolean is signed, but Sun's spec says it should be unsigned.
>
> OK.  I can fix it, but it's an ABI-incompatible change.  There's no
> way this fix could be applied to any existing releases, only gcc
> 4.5.

Excellent ! Is there a bug entry so I can follow the process ?

Thanks,
-- 
Mathieu

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-21  7:17         ` Mathieu Malaterre
@ 2009-07-21  7:49           ` Andrew Haley
  2009-07-21  8:45             ` Mathieu Malaterre
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Haley @ 2009-07-21  7:49 UTC (permalink / raw)
  To: Mathieu Malaterre; +Cc: Florian Weimer, java

On 07/21/2009 08:16 AM, Mathieu Malaterre wrote:
> On Sun, Jul 19, 2009 at 5:16 PM, Andrew Haley<aph@redhat.com> wrote:
>> On 07/19/2009 09:17 AM, Florian Weimer wrote:
>>> * Andrew Haley:
>>>
>>>> On 07/19/2009 07:02 AM, Florian Weimer wrote:
>>>>> * Mathieu Malaterre:
>>>>>
>>>>>>   I am trying to compile VTK using gcj and I am getting those compiler
>>>>>> error, could someone please let me know if the code is legal (should
>>>>>> compile) or not:
>>>>> This is legal per Sun's JNI specficiation: jboolean and jbyte are
>>>>> distinct types because there signedness differs:
>>>>>
>>>>> <http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp198>
>>>>>
>>>>> It's a bug in GCC.
>>>> I didn't see the original message to which this is replying.
>>> It's about C++ code which contains a function overloaded on jbyte and
>>> jboolean.  This fails with GCJ because they are typedef'ed to the same
>>> type.
>>>
>>>> If you can make a test case I'll see if the bug can be fixed.
>>> Compare the table I referenced with these pieces from jni_md.h:
>>>
>>> | typedef int    jbyte  __attribute__((__mode__(__QI__)));
>>> | typedef int    jshort __attribute__((__mode__(__HI__)));
>>> | typedef int    jint   __attribute__((__mode__(__SI__)));
>>> | typedef int    jlong  __attribute__((__mode__(__DI__)));
>>> | typedef int    jboolean __attribute__((__mode__(__QI__)));
>>> | typedef unsigned short jchar __attribute__((__mode__(__HI__)));
>>> | typedef float  jfloat;
>>> | typedef double jdouble;
>>> | typedef jint jsize;
>>>
>>> | typedef int8_t jbyte;
>>> | typedef int16_t jshort;
>>> | typedef int32_t jint;
>>> | typedef int64_t jlong;
>>> | typedef float jfloat;
>>> | typedef double jdouble;
>>> | typedef jint jsize;
>>> | typedef int8_t jboolean;
>>> | typedef uint16_t jchar;
>>>
>>> jboolean is signed, but Sun's spec says it should be unsigned.
>> OK.  I can fix it, but it's an ABI-incompatible change.  There's no
>> way this fix could be applied to any existing releases, only gcc
>> 4.5.
> 
> Excellent ! Is there a bug entry so I can follow the process ?

Not until you make one.

Andrew.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: error: 'jvariant::jvariant(jbyte)' cannot be overloaded
  2009-07-21  7:49           ` Andrew Haley
@ 2009-07-21  8:45             ` Mathieu Malaterre
  0 siblings, 0 replies; 11+ messages in thread
From: Mathieu Malaterre @ 2009-07-21  8:45 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Florian Weimer, java

On Tue, Jul 21, 2009 at 9:48 AM, Andrew Haley<aph@redhat.com> wrote:
> On 07/21/2009 08:16 AM, Mathieu Malaterre wrote:
>> On Sun, Jul 19, 2009 at 5:16 PM, Andrew Haley<aph@redhat.com> wrote:
>>> On 07/19/2009 09:17 AM, Florian Weimer wrote:
>>>> * Andrew Haley:
>>>>
>>>>> On 07/19/2009 07:02 AM, Florian Weimer wrote:
>>>>>> * Mathieu Malaterre:
>>>>>>
>>>>>>>   I am trying to compile VTK using gcj and I am getting those compiler
>>>>>>> error, could someone please let me know if the code is legal (should
>>>>>>> compile) or not:
>>>>>> This is legal per Sun's JNI specficiation: jboolean and jbyte are
>>>>>> distinct types because there signedness differs:
>>>>>>
>>>>>> <http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp198>
>>>>>>
>>>>>> It's a bug in GCC.
>>>>> I didn't see the original message to which this is replying.
>>>> It's about C++ code which contains a function overloaded on jbyte and
>>>> jboolean.  This fails with GCJ because they are typedef'ed to the same
>>>> type.
>>>>
>>>>> If you can make a test case I'll see if the bug can be fixed.
>>>> Compare the table I referenced with these pieces from jni_md.h:
>>>>
>>>> | typedef int    jbyte  __attribute__((__mode__(__QI__)));
>>>> | typedef int    jshort __attribute__((__mode__(__HI__)));
>>>> | typedef int    jint   __attribute__((__mode__(__SI__)));
>>>> | typedef int    jlong  __attribute__((__mode__(__DI__)));
>>>> | typedef int    jboolean __attribute__((__mode__(__QI__)));
>>>> | typedef unsigned short jchar __attribute__((__mode__(__HI__)));
>>>> | typedef float  jfloat;
>>>> | typedef double jdouble;
>>>> | typedef jint jsize;
>>>>
>>>> | typedef int8_t jbyte;
>>>> | typedef int16_t jshort;
>>>> | typedef int32_t jint;
>>>> | typedef int64_t jlong;
>>>> | typedef float jfloat;
>>>> | typedef double jdouble;
>>>> | typedef jint jsize;
>>>> | typedef int8_t jboolean;
>>>> | typedef uint16_t jchar;
>>>>
>>>> jboolean is signed, but Sun's spec says it should be unsigned.
>>> OK.  I can fix it, but it's an ABI-incompatible change.  There's no
>>> way this fix could be applied to any existing releases, only gcc
>>> 4.5.
>>
>> Excellent ! Is there a bug entry so I can follow the process ?
>
> Not until you make one.

Done:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40816


-- 
Mathieu

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-07-21  8:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-16 12:38 error: 'jvariant::jvariant(jbyte)' cannot be overloaded Mathieu Malaterre
2009-07-19  6:02 ` Florian Weimer
2009-07-19  7:52   ` Andrew Haley
2009-07-19  8:17     ` Florian Weimer
2009-07-19 15:17       ` Andrew Haley
2009-07-19 18:53         ` Florian Weimer
2009-07-20  8:17           ` Andrew Haley
2009-07-20  8:28             ` Florian Weimer
2009-07-21  7:17         ` Mathieu Malaterre
2009-07-21  7:49           ` Andrew Haley
2009-07-21  8:45             ` Mathieu Malaterre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).