Skip to content

2.9 regression: can't use scala.collection.mutable.HashMap from Java #4238

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 Feb 11, 2011 · 12 comments
Closed

2.9 regression: can't use scala.collection.mutable.HashMap from Java #4238

scabug opened this issue Feb 11, 2011 · 12 comments
Assignees

Comments

@scabug
Copy link

scabug commented Feb 11, 2011

  ~/nl> java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)
  ~/nl> bin/scala -version                                                             
Scala code runner version 2.9.0.r24265-b20110211020037 -- Copyright 2002-2011, LAMP/EPFL
  ~/nl> cat J.java                                                                     
class J {
	scala.collection.mutable.HashMap<String, String> x =
		new scala.collection.mutable.HashMap<String, String>() ;
}
  ~/nl> javac -classpath project/boot/scala-2.9.0-SNAPSHOT/lib/scala-library.jar J.java
J.java:2: cannot access scala.collection.mutable.HashMap
bad class file: scala/collection/mutable/HashMap.class(scala/collection/mutable:HashMap.class)
undeclared type variable: Entry
Please remove or make sure it appears in the correct subdirectory of the classpath.
	scala.collection.mutable.HashMap<String, String> x =
	                        ^

possibly related: #3249

@scabug
Copy link
Author

scabug commented Feb 11, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4238?orig=1
Reporter: @SethTisue

@scabug
Copy link
Author

scabug commented Feb 11, 2011

@SethTisue said:
(it worked in 2.8.1)

@scabug
Copy link
Author

scabug commented Feb 22, 2011

@odersky said:
I verified that the regression occurs somewhere between 23500 and 23507, so the fix to
#3249 seems to be the culprit. Bumped to high, because it is a blocker for 2.9

@scabug
Copy link
Author

scabug commented Feb 23, 2011

@dragos said:
This has been fixed in r24319.

@scabug
Copy link
Author

scabug commented Feb 24, 2011

@dragos said:
I reopen this as the commit that fixed it was reverted in r23344.

@scabug
Copy link
Author

scabug commented Mar 2, 2011

@paulp said:
Here's the difference from recently working variation to now.
These signatures should not be in there.

  < signature: TE;
  < signature: ()Lscala/collection/mutable/DefaultEntry<TA;TB;>;
  < signature: (Lscala/collection/mutable/DefaultEntry<TA;TB;>;)V

The type variable E is the clunker. It is defined here:

trait HashEntry [A, E] {
  val key: A
  var next: E = _
}

Then DefaultEntry extends that.

final class DefaultEntry[A, B](val key: A, var value: B)
  extends HashEntry[A, DefaultEntry[A, B]] with Serializable

But DefaultEntry#next's signature refers to E instead of DefaultEntry<TA;TB;>.

This is perhaps related to next being a var (having a getter.)

@scabug
Copy link
Author

scabug commented Mar 3, 2011

@paulp said:
I've just about got this wrapped up.

@scabug
Copy link
Author

scabug commented Mar 3, 2011

@paulp said:
(In r24369) Seem to have made a breakthrough with signature correctness.
Most of the remaining troubles were due to inherited members
and their foreign identifiers, but I think I found a simple way
to make everyone happy. Closes #4238, review by moors.

@scabug
Copy link
Author

scabug commented Mar 3, 2011

@SethTisue said:
as of r24372:

BUILD FAILED
/Users/tisue/scala/build.xml:48: The following error occurred while executing this line:
/Users/tisue/scala/build.xml:1555: java.lang.RuntimeException: Test suite finished with 1 case failing:
/Users/tisue/scala/test/files/run/bug4238 [FAILED]
	at scala.sys.package$$.error(package.scala:27)
	at scala.tools.partest.PartestTask$$$$anonfun$$f$$1$$1.apply(PartestTask.scala:291)
	at scala.tools.partest.PartestTask$$$$anonfun$$f$$1$$1.apply(PartestTask.scala:291)
	at scala.tools.partest.PartestTask.execute(PartestTask.scala:300)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:390)
	at org.apache.tools.ant.Target.performTasks(Target.java:411)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
	at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:390)
	at org.apache.tools.ant.Target.performTasks(Target.java:411)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
	at org.apache.tools.ant.Main.runBuild(Main.java:809)
	at org.apache.tools.ant.Main.startAnt(Main.java:217)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

this is after ant all.clean; ant dist

@scabug
Copy link
Author

scabug commented Mar 3, 2011

@paulp said:
Yeah, I know. It was working the commit before that one, and fixing the other broken test apparently broke this one. I say apparently because 4238 passes on my machine. At least the tests are doing something useful.

@scabug
Copy link
Author

scabug commented Mar 4, 2011

@dragos said:
Paul, I believe you're on this anyway, so I reassign it to you.

@scabug
Copy link
Author

scabug commented Mar 6, 2011

@paulp said:
(In r24390) Re-enabling the disabled signature test along with changes which
allow it to pass. Closes #4238 again, no review. (But would anyone
like to expand the signature tests? Great idea, extempore!)

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

No branches or pull requests

2 participants