Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java interop issue: illegal inheritance error #4937

Closed
scabug opened this issue Aug 22, 2011 · 3 comments
Closed

Java interop issue: illegal inheritance error #4937

scabug opened this issue Aug 22, 2011 · 3 comments

Comments

@scabug
Copy link

scabug commented Aug 22, 2011

An Illegal inheritance error is thrown by the compiler trying to inherit java classes/ interfaces in the following way:

interface A<T>{}

interface B<T> extends A<T>{}

interface C extends A{}

class D implements B,C {
	public D(){};
}

Trying to subclass D in scala:

scala> class Foo extends D
<console>:7: error: illegal inheritance;
 class Foo inherits different type instances of trait A:
A[T] and A[T]
       class Foo extends D
             ^

The problem appeared when trying to subclass org.apache.commons.buffer.PriorityBuffer, so there are real life situations where this leads to scala<->java interop problems.

http://commons.apache.org/collections/apidocs/org/apache/commons/collections/buffer/PriorityBuffer.html

@scabug
Copy link
Author

scabug commented Aug 22, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4937?orig=1
Reporter: Daniel Degrandi (danieldegrandi)
Affected Versions: 2.9.0-1

@scabug
Copy link
Author

scabug commented Aug 24, 2011

@soc said (edited on Aug 25, 2011 11:07:45 AM UTC):
This looks at least related to #3634, which involves raw types. I'm pretty sure though, that there are also other duplicates about this ...

The source code in the source jar defines:

public class PriorityBuffer extends AbstractCollection implements Buffer, Serializable { ... }

So basically:

  • this involves raw types, which are not supported in Scala
  • Sun/Oracle reserves the right to remove support of raw types from javac in the future

=> this will most probably be a WON'T FIX
=> it is Apache's duty to fix it (but considering that the last release was 2008, I consider the library to be not maintained)

@daniel: Your best chance is to file a bug in Apache's bug tracker for it.

@scabug
Copy link
Author

scabug commented Aug 25, 2011

@paulp said:
Yes, there are a number of closed wontfix tickets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants