Skip to content

Can't use protected Java class from an overriden protected method? #1911

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

Closed
scabug opened this issue Apr 22, 2009 · 2 comments
Closed

Can't use protected Java class from an overriden protected method? #1911

scabug opened this issue Apr 22, 2009 · 2 comments

Comments

@scabug
Copy link

scabug commented Apr 22, 2009

I'm trying to use the org.apache.commons.collections.map.LRUMap class in http://commons.apache.org/collections/. I need to override the "removeLRU" method there, which was made exactly for the purpose of overriding.
(see [http://commons.apache.org/collections/api-release/org/apache/commons/collections/map/LRUMap.html#removeLRU(org.apache.commons.collections.map.AbstractLinkedMap.LinkEntry) removeLRU])

Compiling the following program

object test {
  import org.apache.commons.collections.map.LRUMap, org.apache.commons.collections.map.AbstractLinkedMap
  val map = new LRUMap {
    override def removeLRU (entry: AbstractLinkedMap.LinkEntry): Boolean = {
      // do something ...
      true
    }
  }
}

with Scala (Eclipse Plugin) 2.7.3.final I get the following error:
"class LinkEntry cannot be accessed in object org.apache.commons.collections.map.AbstractLinkedMap"

The identical Java program compiles okay:

class test {
  LRUMap map = new LRUMap() {
    protected boolean removeLRU (AbstractLinkedMap.LinkEntry entry) {
      // do something ...
      return true;
    }
  };
}
@scabug
Copy link
Author

scabug commented Apr 22, 2009

Imported From: https://issues.scala-lang.org/browse/SI-1911?orig=1
Reporter: ArtemGr (artemgr)

@scabug
Copy link
Author

scabug commented Apr 22, 2009

@dragos said:
This is a duplicate of #1806. You can find there more background information.

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

1 participant