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

scalac can't compile Java-classes containing type-annotations #9853

Closed
scabug opened this issue Jul 11, 2016 · 7 comments
Closed

scalac can't compile Java-classes containing type-annotations #9853

scabug opened this issue Jul 11, 2016 · 7 comments

Comments

@scabug
Copy link

scabug commented Jul 11, 2016

The attached Java-classes contain a valid Annotation in TestAnnotation which is used in AnnotationTest.

Compiling with javac works using the following commandline:
*javac -d classes .java

Compiling with scalac breaks using the following commandline:
*scalac -d classes .java

AnnotationTest.java:4: error: illegal start of type
    public void testMethod(List<@TestAnnotation String> annotatedList);
                                ^
AnnotationTest.java:5: error: `>' expected but `}' found.
}
^
two errors found

This might be related to SI-8056, I am posting it anyway as I think this shouldn't break compiling Java-classes.

@scabug
Copy link
Author

scabug commented Jul 11, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9853?orig=1
Reporter: Jochen (codepitbull)
Affected Versions: 2.11.8
See #8056
Attachments:

@scabug
Copy link
Author

scabug commented Aug 3, 2016

@SethTisue said:
is there a need for scalac to do anything with the annotations besides just ignore them? if not, this ought to be an easy fix. I don't think the Java parser is especially entangled with the rest of scalac

@scabug
Copy link
Author

scabug commented Aug 4, 2016

Jochen (codepitbull) said:
I don't think so. In my case the annotation is only used by an annotation parser to generate code.
So I think it would be save to simply ignore them on the Scala side.
But I am not sure that this would cover all usecases.
For now it would definitely be the best to simply ignore them as this will at least allow to build a project containing them.

@scabug
Copy link
Author

scabug commented Mar 9, 2017

Matthias Kurz (mkurz) said (edited on Mar 12, 2017 5:03:06 PM UTC):
This is working in Scala 2.12.1 already. (It works with the two files attached to this issue and also with Java classes within our app)

I think issue can be marked as resolved.

@scabug
Copy link
Author

scabug commented Mar 12, 2017

Matthias Kurz (mkurz) said (edited on Mar 12, 2017 6:48:16 PM UTC):
Can someone of the core team confirm this is officially fixed and not just a side effect of another fix so it doesn't break again in the future?
Are there any tests for this issue?
We want to rely that this is working not just in Scala 2.12.1 but any future Scala versions.

Thank you!

@scabug
Copy link
Author

scabug commented Mar 12, 2017

@som-snytt said (edited on Mar 12, 2017 9:36:38 PM UTC):
scala/scala@7e57bcc

Edit: sorry, you asked for the core team. They might be asleep right now. Also, we had the daylight saving time switch, so even folks in this TZ are asleep. I'm asleep at the keyboard right now.

@scabug
Copy link
Author

scabug commented Mar 12, 2017

Matthias Kurz (mkurz) said:
@A. P. Marki - thanks, it's not that urgent ;)

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

No branches or pull requests

2 participants