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

Added @Language to String source code params #522

Merged
merged 1 commit into from Oct 25, 2015

Conversation

paplorinc
Copy link
Contributor

language
By annotating parameters with @language('Groovy') we will have IDE support
(e.g. syntax check and highlighting) for inlined languages (mostly used in tests)

@@ -13,6 +13,7 @@ Spock is inspired from JUnit, jMock, RSpec, Groovy, Scala, Vulcans, and other fa
dependencies {
compile libs.groovy // easiest way to add Groovy dependency to POM
compile libs.junit
compile libs.annotations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be optional? You would need to add it to spock-specs as well, but I think this is better than to force it on users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean by forcing it on the user (what drawbacks will the user have exactly? It would also eliminate the need for the custom @Nullable annotation already available) or how the used annotations could be optional (I don't think that if I put it in comments or put the dependency to runtime (i.e. non-packaged)) would work (however, I did find an update for the annotations on Maven Central)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just look two lines below compile libs.annotations, optional and I think it should be called intellijAnnotations.

Not sure what you mean by forcing it on the user
I mean we increase the amount of dependencies, even for users who use, e.g., eclipse and don't profit from it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency only contains annotation declarations (http://grepcode.com/file/repo1.maven.org/maven2/org.jetbrains/annotations/13.0/org/intellij/lang/annotations), I think the added value supersedes the cost.

If you don't agree, I could still add only the Language.java file to the project (with the original package) and change the RetentionPolicy to SOURCE.
However, I think that's a hacky solution!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Java ignores missing annotations so there shouldn't be any issues with
setting this dependency to optional. If someone has those annotations in his classpath it will they will be used, otherwise they'll be dropped.
https://stackoverflow.com/questions/3567413/why-doesnt-a-missing-annotation-cause-a-classnotfoundexception-at-runtime

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, if you find it's better like that. Please see my updated commit (could you please retrigger the failing build).

@leonard84
Copy link
Member

I think that this is a valuable addition, as long as this can be an optional dependency.

@paplorinc paplorinc force-pushed the GroovyLanguageAnnotation branch 4 times, most recently from a80cbc4 to 9bf6aae Compare September 14, 2015 20:15
By annotating parameters with @language('Groovy') we'll have IDE support
(e.g. syntax check and highlighting) for inlined languages (mostly used in tests)
leonard84 added a commit that referenced this pull request Oct 25, 2015
@leonard84 leonard84 merged commit 52ff74b into spockframework:master Oct 25, 2015
@robfletcher robfletcher modified the milestone: 1.1-rc-1 Aug 24, 2016
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 this pull request may close these issues.

None yet

3 participants