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.util.NoSuchElementException: None.get in BasicTransform.deprecationInfo #286

Closed
jrudolph opened this issue Jul 13, 2021 · 2 comments · Fixed by #287
Closed

java.util.NoSuchElementException: None.get in BasicTransform.deprecationInfo #286

jrudolph opened this issue Jul 13, 2021 · 2 comments · Fixed by #287

Comments

@jrudolph
Copy link
Contributor

This works with 2.13.5 / 0.16 but fails with the same code with 2.13.6 / 0.17.

Unfortunately, it's not reporting which source file / line might be the problem.

See https://jenkins.akka.io:8498/job/pr-validator-akka-http/5768/console
akka/akka-http#3870

[error] ## Exception when compiling 379 sources to /home/jenkins/workspace/workspace/pr-validator-akka-http/akka-http-core/target/scala-2.13/classes
[error] java.util.NoSuchElementException: None.get
[error] scala.None$.get(Option.scala:627)
[error] scala.None$.get(Option.scala:626)
[error] com.typesafe.genjavadoc.BasicTransform.deprecationInfo(BasicTransform.scala:163)
[error] com.typesafe.genjavadoc.BasicTransform.deprecationInfo(BasicTransform.scala:160)
[error] com.typesafe.genjavadoc.BasicTransform.withClass(BasicTransform.scala:129)
[error] com.typesafe.genjavadoc.BasicTransform.newTransform(BasicTransform.scala:91)
[error] com.typesafe.genjavadoc.BasicTransform.newTransform$(BasicTransform.scala:49)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.newTransform(Plugin.scala:93)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.transform(Plugin.scala:103)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.transform(Plugin.scala:93)
[error] scala.reflect.api.Trees$Transformer.$anonfun$transformStats$1(Trees.scala:2622)
[error] scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2620)
[error] scala.reflect.internal.Trees$PackageDef.$anonfun$transform$1(Trees.scala:342)
[error] scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2633)
[error] scala.reflect.internal.Trees$PackageDef.transform(Trees.scala:342)
[error] scala.reflect.internal.Trees$InternalTransformer.transform(Trees.scala:1489)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.superTransform(Plugin.scala:102)
[error] com.typesafe.genjavadoc.BasicTransform.newTransform(BasicTransform.scala:115)
[error] com.typesafe.genjavadoc.BasicTransform.newTransform$(BasicTransform.scala:49)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.newTransform(Plugin.scala:93)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.transform(Plugin.scala:103)
[error] scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:183)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.superTransformUnit(Plugin.scala:101)
[error] com.typesafe.genjavadoc.BasicTransform.newTransformUnit(BasicTransform.scala:20)
[error] com.typesafe.genjavadoc.BasicTransform.newTransformUnit$(BasicTransform.scala:19)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.newTransformUnit(Plugin.scala:93)
[error] com.typesafe.genjavadoc.GenJavadocPlugin$MyComponent$GenJavadocTransformer.transformUnit(Plugin.scala:104)
[error] scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:32)
[error] scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
[error] scala.tools.nsc.Global$GlobalPhase.run(Global.scala:401)
[error] scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1519)
[error] scala.tools.nsc.Global$Run.compileUnits(Global.scala:1503)
[error] scala.tools.nsc.Global$Run.compileSources(Global.scala:1495)
[error] scala.tools.nsc.Global$Run.compileFiles(Global.scala:1609)
[...]
@jrudolph
Copy link
Contributor Author

Works for 2.13.5 with 0.17, so it's probably a behavior change in 2.13.6.

Here's the failing method:

private def deprecationInfo(symbol: Symbol): Option[DeprecationInfo] =
if (symbol.isDeprecated) {
val deprec = symbol.annotations.find(_.toString contains "deprecated(").get
Some(DeprecationInfo(deprec.stringArg(0).getOrElse(""), deprec.stringArg(1).getOrElse("")))
} else None

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

Successfully merging a pull request may close this issue.

1 participant