Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Scala3.3.1 cannot compile generic parameter definitions with annotations in Java? #18936

jxnu-liguobin started this conversation in General Discussion
Discussion options

Compiler complaint: illegal start of type

class OptionalExtractor implements ValueExtractor<Option<@ExtractedValue ?>> {
 private OptionalExtractor() {
 }
 @Override
 public void extractValues(Option<?> originalValue, ValueReceiver receiver) {
 receiver.value(null, originalValue.isDefined() ? originalValue.get() : null);
 }
} 
You must be logged in to vote

Replies: 1 comment 6 replies

Comment options

What dependency do I need to add in order to compile this?

Is it possible to provide a self-contained reproduction that doesn't require any dependency at all?

Is it a regression since Scala 2?

You must be logged in to vote
6 replies
Comment options

Although modifying the compilation order can work

Okay, good, I was going to suggest that. Many projects don't need Mixed mode compilation (the default in sbt) and do fine with JavaThenScala or ScalaThenJava, which avoids having the Scala compiler process Java sources at all. (I think you know this, but stating it for the record anyway.)

publishLocal will still fail

Well, that seems strange. Do you have any insight into why?

Comment options

It's because of scaladoc. compileOrder doesn't work for scaladoc.

[error] class OptionalExtractor implements ValueExtractor<Option<@ExtractedValue ?>> {
[error] ^
[error] /Users/liguobin/Projects/smt/smt-common/src/main/scala/org/bitlap/common/OptionalExtractor.java:38:2: `>` expected but eof found.
[error] } 
[error] ^
[error] two errors found
[error] Scaladoc generation failed
[error] 	at xsbt.Runner.run(ScaladocBridge.scala:50)
[error] 	at xsbt.ScaladocBridge.run(ScaladocBridge.scala:21)
[error] 	at sbt.internal.inc.AnalyzingCompiler.doc(AnalyzingCompiler.scala:154)
[error] 	at sbt.internal.inc.AnalyzingCompiler.doc(AnalyzingCompiler.scala:133)
[error] 	at sbt.Doc$.$anonfun$scaladoc1ドル(Doc.scala:52)
[error] 	at sbt.Doc$.$anonfun$scaladoc1ドル$adapted(Doc.scala:40)
[error] 	at sbt.RawCompileLike$.$anonfun$prepare1ドル(RawCompileLike.scala:79)
[error] 	at sbt.RawCompileLike$.$anonfun$prepare1ドル$adapted(RawCompileLike.scala:72)
[error] 	at sbt.RawCompileLike$.$anonfun$cached4ドル(RawCompileLike.scala:63)
[error] 	at sbt.RawCompileLike$.$anonfun$cached4ドル$adapted(RawCompileLike.scala:61)
[error] 	at sbt.util.Tracked$.$anonfun$inputChangedW1ドル(Tracked.scala:219)
[error] 	at sbt.RawCompileLike$.$anonfun$cached1ドル(RawCompileLike.scala:68)
[error] 	at sbt.RawCompileLike$.$anonfun$cached1ドル$adapted(RawCompileLike.scala:52)
[error] 	at sbt.Defaults$.$anonfun$docTaskSettings4ドル(Defaults.scala:2156)
[error] 	at scala.Function1.$anonfun$compose1ドル(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u22191ドル(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon4ドル.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit2ドル(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:291)
[error] 	at sbt.Execute.$anonfun$submit1ドル(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon4ドル.$anonfun$submitValid1ドル(ConcurrentRestrictions.scala:265)
Comment options

I was going to ask in chat how projects doc their java. stdlib has at least one public java class that is undocumented. I think scaladoc should be more helpful here. (I noticed that while looking at a scaladoc bug.)

Comment options

compileOrder doesn't work for scaladoc

even if you set it in Compile / doc (as well as Compile / compile)?

if there's no way around this, it seems like it should be an sbt ticket or a scala/bug ticket, wherever the root cause is?

Comment options

I have tried ,but sbt said there's a key that's not used by any other settings/tasks

[info] loading settings for project smt from build.sbt ...
[info] set current project to smt (in build file:/Users/liguobin/Projects/smt/)
[warn] there's a key that's not used by any other settings/tasks:
[warn] 
[warn] * smt-common / Compile / doc / compileOrder
[warn] +- /Users/liguobin/Projects/smt/build.sbt:70
[warn] 
[warn] note: a setting might still be used by a command; to exclude a key from this `lintUnused` check
[warn] either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /