Closed scabug closed 13 years ago
Imported From: https://issues.scala-lang.org/browse/SI-2868?orig=1 Reporter: Jan Kriesten (jkriesten) Attachments:
@paulp said: I notice LiteralAnnotArg is pickled two different ways, once as a ref, once not.
case LiteralAnnotArg(const) =>
putConstant(const)
...
case LiteralAnnotArg(const) =>
writeRef(const)
@lrytz said: i'll look at it. a test case would be helpful obviously :)
Jan Kriesten (jkriesten) said: Is there a way to track down on which file/place/annotation the exception occurs (it's a bigger maven project) - i have tried to add -Xprint:all to the compiler and see where it crashes. But every attempt to reproduce this on a simple test-case has failed yet.
One difference between the project and command line print:all-output makes me curious, though:
On the crashing project I get:
@new Parameters(Array("webappPath")) @new Test(groups = Array("unit"))
Whereas the command line version produces
@org.testng.annotations.Parameters(value = ["webappPath"]) @org.testng.annotations.Test(groups = ["unit"])
Jan Kriesten (jkriesten) said: Test case (depending on guice-2, quartz and servlet-api, sorry for that)
Jan Kriesten (jkriesten) said: I could create a smaller test-case, though it depends on third-party libraries. I have attached my sources (and another compiled class). You'll find a zip including the deps here:
http://www.footprint.de/test/scala/annot.zip
Calling
scalac -cp classes:guice-2.0.jar:aopalliance-1.0.jar:servlet-api-2.5.jar:quartz-1.7.0.jar src/test.scala
will throw the exception.
I hope you can reproduce it with this example and track down the problems.
Best regards, --- Jan.
@paulp said: Replying to [comment:4 jkriesten]:
I hope you can reproduce it with this example and track down the problems.
exception when typing SchedulerProvider.QUARTZ_FACTORY_KEY_ID
Did you not include the source? Your changes of a resolution are many times lower without source.
I happened to google this message: http://www.mail-archive.com/google-guice-dev@googlegroups.com/msg00014.html
Do you still have methods and fields with the same name? That would have to be a leading contender for inducing bugs in scala.
Jan Kriesten (jkriesten) said: H Paul,
there were problems some time ago with guice, but these have been fixed and never bothered again.
Also: no, I don't have methods and fields with the same name (but class and companion object). The problem isn't guice, but the unpickler getting confused by annotations.
You'll find the source of the Schedulerprovider attached.
Best regards, --- Jan.
Jan Kriesten (jkriesten) said: Source code of the SchedulerProvider class
@paulp said: Lukas -- if you compile SchedulerProvider.scala you will see an inconsistent pickler entry at 36:
34,219: TERMname 21: QUARTZ_FACTORY_KEY_ID
35,242: POLYtpe 1: 36
36,245: CONSTANTtpe 1: 37 33
BAD ENTRY END: computed = 248, actual = 249, bytes = 15, 1, 37, 33
It says only one byte to follow but finds two. I am confused because the pickler format documentation says there should be two, a typeRef and a constantRef:
* | 15 CONSTANTtpe len_Nat type_Ref constant_Ref
However in reality there is only one, and from looking at how constant types are done, it seems like there should be only one.
// Pickler
case ConstantType(value) =>
writeRef(value); CONSTANTtpe
// Unpickler
case CONSTANTtpe =>
mkConstantType(readConstantRef())
...and as that's all the time I have, this concludes today's visit to Picklerdom. Join us next week and every week here at Trac Mystery Theatre.
@lrytz said: i got it, pretty nasty :) more later.
@lrytz said: (In r20688) close #2868. problem was: when the same constant is used in a ConstantType and a LiteralAnnotArg, it is stored inside the unpickle cache 'entries' (see 'def at' in UnPickler) once as Constant, once as LiteralAnnotArg, resulting in a CCE for the second read. review by extempore.
@lrytz said: (In r20704) now correctly fix #2868. no review
This happens during compilation with the current nightly (scala-compiler-2.8.0-20100107.032215-297):
I haven't found the place causing it yet, if I have more information I'll let you know.