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.lang.reflect.GenericSignatureFormatError when compiling Java sources #1035

Closed
Sciss opened this issue Dec 11, 2013 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@Sciss
Copy link

Sciss commented Dec 11, 2013

I have a project which include some Java sources which make sbt crash during compilation. I am using sbt 0.13.0 with Java 6 (OS X). To reproduce:

$ git clone https://github.com/Sciss/TreeTable.git
...
$ cd TreeTable
$ git checkout 00daa4288574b658c8bb643cb2ddf9768195c50a
$ sbt compile

This will compile the project. sbt will crash at some point:

[info] Loading global plugins from /Users/hhrutz/.sbt/0.13/plugins
[info] Loading project definition from /Users/hhrutz/Desktop/sbtprob/TreeTable/project
[info] Updating {file:/Users/hhrutz/Desktop/sbtprob/TreeTable/project/}treetable-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/hhrutz/Desktop/sbtprob/TreeTable/project/target/scala-2.10/sbt-0.13/classes...
[info] Set current project to TreeTable (in build file:/Users/hhrutz/Desktop/sbtprob/TreeTable/)
[info] Updating {file:/Users/hhrutz/Desktop/sbtprob/TreeTable/}treetable-java...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Updating {file:/Users/hhrutz/Desktop/sbtprob/TreeTable/}treetable-scala...
[info] Resolving org.scala-lang#scala-swing;2.10.2 ...
[info] Compiling 29 Java sources to /Users/hhrutz/Desktop/sbtprob/TreeTable/java/target/classes...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Updating {file:/Users/hhrutz/Desktop/sbtprob/TreeTable/}treetable...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[warn] Note: Some input files use unchecked or unsafe operations.
[warn] Note: Recompile with -Xlint:unchecked for details.
java.lang.reflect.GenericSignatureFormatError
    at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103)
    at sun.reflect.generics.parser.SignatureParser.parseSimpleClassTypeSignature(SignatureParser.java:262)
    at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignatureSuffix(SignatureParser.java:270)
    at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignature(SignatureParser.java:244)
    at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:228)
    at sun.reflect.generics.parser.SignatureParser.parseTypeSignature(SignatureParser.java:359)
    at sun.reflect.generics.parser.SignatureParser.parseReturnType(SignatureParser.java:490)
    at sun.reflect.generics.parser.SignatureParser.parseMethodTypeSignature(SignatureParser.java:436)
    at sun.reflect.generics.parser.SignatureParser.parseMethodSig(SignatureParser.java:141)
    at sun.reflect.generics.repository.ConstructorRepository.parse(ConstructorRepository.java:37)
    at sun.reflect.generics.repository.ConstructorRepository.parse(ConstructorRepository.java:25)
    at sun.reflect.generics.repository.AbstractRepository.<init>(AbstractRepository.java:56)
    at sun.reflect.generics.repository.GenericDeclRepository.<init>(GenericDeclRepository.java:30)
    at sun.reflect.generics.repository.ConstructorRepository.<init>(ConstructorRepository.java:33)
    at sun.reflect.generics.repository.MethodRepository.<init>(MethodRepository.java:28)
    at sun.reflect.generics.repository.MethodRepository.make(MethodRepository.java:41)
    at java.lang.reflect.Method.getGenericInfo(Method.java:94)
    at java.lang.reflect.Method.getTypeParameters(Method.java:196)
    at sbt.ClassToAPI$.methodToDef(ClassToAPI.scala:143)
    at sbt.ClassToAPI$$anonfun$7.apply(ClassToAPI.scala:73)
    at sbt.ClassToAPI$$anonfun$7.apply(ClassToAPI.scala:73)
    at sbt.ClassToAPI$$anonfun$mergeMap$1.apply(ClassToAPI.scala:175)
    at sbt.ClassToAPI$$anonfun$mergeMap$1.apply(ClassToAPI.scala:175)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:34)
    at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
    at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
    at sbt.ClassToAPI$.merge(ClassToAPI.scala:181)
    at sbt.ClassToAPI$.mergeMap(ClassToAPI.scala:175)
    at sbt.ClassToAPI$.structure(ClassToAPI.scala:73)
    at sbt.ClassToAPI$.x$2$lzycompute$1(ClassToAPI.scala:62)
    at sbt.ClassToAPI$.x$2$1(ClassToAPI.scala:62)
    at sbt.ClassToAPI$.instance$lzycompute$1(ClassToAPI.scala:62)
    at sbt.ClassToAPI$.sbt$ClassToAPI$$instance$1(ClassToAPI.scala:62)
    at sbt.ClassToAPI$$anonfun$5.apply(ClassToAPI.scala:63)
    at sbt.ClassToAPI$$anonfun$5.apply(ClassToAPI.scala:63)
    at xsbti.SafeLazy$Impl._t$lzycompute(SafeLazy.scala:20)
    at xsbti.SafeLazy$Impl._t(SafeLazy.scala:18)
    at xsbti.SafeLazy$Impl.get(SafeLazy.scala:24)
    at sbt.ClassToAPI$$anonfun$process$1.apply(ClassToAPI.scala:22)
    at sbt.ClassToAPI$$anonfun$process$1.apply(ClassToAPI.scala:22)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
    at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
    at sbt.ClassToAPI$.process(ClassToAPI.scala:22)
    at sbt.compiler.AggressiveCompile$$anonfun$3.sbt$compiler$AggressiveCompile$$anonfun$$readAPI$1(AggressiveCompile.scala:130)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2$$anonfun$apply$6.apply(AggressiveCompile.scala:138)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2$$anonfun$apply$6.apply(AggressiveCompile.scala:138)
    at sbt.classfile.Analyze$$anonfun$apply$9.apply(Analyze.scala:45)
    at sbt.classfile.Analyze$$anonfun$apply$9.apply(Analyze.scala:43)
    at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
    at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98)
    at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98)
    at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:226)
    at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:39)
    at scala.collection.mutable.HashMap.foreach(HashMap.scala:98)
    at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
    at sbt.classfile.Analyze$.apply(Analyze.scala:43)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:138)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:136)
    at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply$mcV$sp(AggressiveCompile.scala:136)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply(AggressiveCompile.scala:136)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply(AggressiveCompile.scala:136)
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159)
    at sbt.compiler.AggressiveCompile$$anonfun$3.compileJava$1(AggressiveCompile.scala:135)
    at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142)
    at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36)
    at sbt.inc.Incremental$.cycle(Incremental.scala:73)
    at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:33)
    at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:32)
    at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:41)
    at sbt.inc.Incremental$.compile(Incremental.scala:32)
    at sbt.inc.IncrementalCompile$.apply(Compile.scala:26)
    at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150)
    at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
    at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45)
    at sbt.Compiler$.apply(Compiler.scala:70)
    at sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:722)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:716)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:716)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)

If one runs compile again, it apparently succeeds, but has some incomplete state (see Stack Overflow).

@ghost ghost assigned gkossakowski Dec 11, 2013
harrah added a commit that referenced this issue Dec 13, 2013
@harrah harrah closed this as completed in b09cf5b Dec 13, 2013
@ghost ghost assigned harrah Dec 13, 2013
@harrah
Copy link
Member

harrah commented Dec 13, 2013

This appears to be a Java reflection bug, probably one of the ones linked here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6476261. The commit here is a workaround.

@Sciss
Copy link
Author

Sciss commented Dec 13, 2013

Ok, thanks!

harrah added a commit that referenced this issue Mar 21, 2014
harrah added a commit that referenced this issue Mar 21, 2014
jvican added a commit to scalacenter/zinc that referenced this issue Aug 11, 2017
The workarounds are not necessary anymore,
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6476261 has been
fixed in JDK8, which is the JDK version that Zinc demands.
jvican added a commit to scalacenter/zinc that referenced this issue Sep 28, 2017
The workarounds are not necessary anymore,
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6476261 has been
fixed in JDK8, which is the JDK version that Zinc demands.
jvican added a commit to scalacenter/zinc that referenced this issue Sep 28, 2017
The workarounds are not necessary anymore,
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6476261 has been
fixed in JDK8, which is the JDK version that Zinc demands.
jvican added a commit to scalacenter/zinc that referenced this issue Sep 28, 2017
The workarounds are not necessary anymore,
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6476261 has been
fixed in JDK8, which is the JDK version that Zinc demands.
jvican added a commit to scalacenter/zinc that referenced this issue Sep 28, 2017
The workarounds are not necessary anymore,
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6476261 has been
fixed in JDK8, which is the JDK version that Zinc demands.
jvican added a commit to sbt/zinc that referenced this issue Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants