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

Introduce ConstantAnnotation and remove ClassfileAnnotation and associated warning #7041

Closed
scabug opened this issue Jan 30, 2013 · 14 comments
Closed

Comments

@scabug
Copy link

scabug commented Jan 30, 2013

  • remove ClassfileAnnotation (and the warning)
  • introduce ConstantAnnotation do to exactly what ClassfileAnnotation does now, but without a warning
  • make SerialVersionUID extend ConstantAnnotation

as discussed in scala/scala#1924

@scabug
Copy link
Author

scabug commented Jan 30, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7041?orig=1
Reporter: @adriaanm
See #6991

@scabug
Copy link
Author

scabug commented Jan 30, 2013

@xeno-by said:
Could we come up with a better name please? To tell the truth, I didn't understand what ConstantAnnotation is supposed to mean until I skimmed through the pull request discussion.

@scabug
Copy link
Author

scabug commented Jan 30, 2013

@lrytz said:
ideas?

@scabug
Copy link
Author

scabug commented Jan 30, 2013

@xeno-by said:
Reading this actually clarified things a lot, and now I think the name's fine:

I'm not sure if we should follow java here. Scala has only two levels: The default (same as SOURCE in java) and persisted (StaticAnnotation, same as RUNTIME in java). All persisted annotations are visible in (Scala) reflection (and of course in the compiler). I think this works well and I don't see much reason for adding a third level.

The thing we are discussing here is completely orthogonal: it's is about enforcing constant arguments. It's just a tool we give to annotation writers. They should be able to use it with normal and with static annotations.

Java compatibility (i.e. writing java-compatible annotations), finally, is yet another orthogonal issue. To emit java annotations we'd need to enforce constants, and on top of that we might also want to support the three java persistence levels. The latter could be achieved with meta-annotations. But let's not confuse things here.

There's another question though. Why do we need a hardcode into the compiler to verify that something's a constant, when we have macros? Unfortunately unless we have type macros, it's out of the question though :(

@scabug
Copy link
Author

scabug commented Feb 28, 2013

@lrytz said (edited on Feb 28, 2013 7:17:52 AM UTC):
This is on hold, it won't happen for 2.10.x because of forward binary compatibility, and in 2.11 we might have better ways to solve it (type macros). See https://groups.google.com/forum/#!topic/scala-internals/ipyrn6c8c8o/discussion

@scabug
Copy link
Author

scabug commented Mar 15, 2013

@adriaanm said:
Un-assigning to foster work stealing, as announced in https://groups.google.com/forum/?fromgroups=#!topic/scala-internals/o8WG4plpNkw

@scabug
Copy link
Author

scabug commented Mar 26, 2013

@soc said:
Is there a chance to get at least the existing work (remove the warning) merged?

I'm tired of getting spammed with 5 lines of nonsense every time I compile the library.

@scabug
Copy link
Author

scabug commented Mar 26, 2013

@lrytz said:
In my opinion, no. We can make the warning more precise, but that gives us even more noise in the places where it's being "abused".

@scabug
Copy link
Author

scabug commented Mar 27, 2013

@soc said:
What's more precise? As is, the warning is flat-out wrong.

@scabug
Copy link
Author

scabug commented Apr 30, 2013

@soc said:
Could we please please please get rid of this “2 plus 2 is not 5” warning?
I'm sick having to read this non-sense twice every time I compile Scala.

@scabug
Copy link
Author

scabug commented Jul 10, 2013

@adriaanm said:
Unassigning and rescheduling to M6 as previous deadline was missed.

@scabug
Copy link
Author

scabug commented Jan 6, 2015

@adriaanm said (edited on Jan 6, 2015 11:46:02 PM UTC):
We should really clean this up in 2.12. I find it quite bizarre that an annotation must be both java-defined and a subclass of ClassFileAnnotation (a Scala marker trait!). This conundrum was introduced 7 years ago, so it may be time to reconsider. (scala/scala@0b00cb9fc3)

@scabug
Copy link
Author

scabug commented Jan 7, 2015

@soc said:
Yep, I'm almost there (famous last words...)! I'm currently stuck on https://groups.google.com/d/msg/scala-internals/mH20kYunolM/93D41AjqdmAJ ... I either don't get it to work (condition doesn't trigger) or I run into an endless recursion. I need to look at it again to figure out what I'm doing wrong.

@lrytz
Copy link
Member

lrytz commented Nov 3, 2017

scala/scala#6143

@adriaanm adriaanm modified the milestones: 2.13.0-M3, 2.13.0-M4 Jan 30, 2018
@lrytz lrytz modified the milestones: 2.13.0-M4, m3 Apr 19, 2018
@lrytz lrytz modified the milestones: m3, 2.13.0-M3 Apr 19, 2018
@lrytz lrytz closed this as completed Apr 19, 2018
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

4 participants