You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2021/02/22 07:00:47 UTC

[GitHub] [groovy] paulk-asert opened a new pull request #1496: GROOVY-6360: move @Pure to separate subproject.

paulk-asert opened a new pull request #1496:
URL: https://github.com/apache/groovy/pull/1496


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] paulk-asert commented on a change in pull request #1496: GROOVY-6360: move @Pure to separate subproject.

Posted by GitBox <gi...@apache.org>.
paulk-asert commented on a change in pull request #1496:
URL: https://github.com/apache/groovy/pull/1496#discussion_r580927211



##########
File path: src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
##########
@@ -190,6 +191,15 @@ public static boolean trySetAccessible(final AccessibleObject ao) {
         return false;
     }
 
+    public static boolean hasAnnotationWithSimpleName(AccessibleObject obj, String simpleName) {

Review comment:
       We can use full names. There are other annotations, e.g.:
   checker framework's `org.checkerframework.dataflow.qual.Pure`
   pure4j's `org.pure4j.annotations.pure.Pure`
   JPure's `@Pure`
   JML's `@Pure`
   XText has `org.eclipse.xtext.xbase.lib.Pure`
   Effect tracked Java uses `@Pure` (and `@Impure`)
   C4J uses `de.vksi.c4j.Pure`
   and `net.digitalid.utility.annotations.method.Pure`
   which do essentially the same thing as ours.
   Counter examples: Frege has a `pure` keyword, JetBrains has `@Contract` with a `pure` boolean annotation attribute.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] danielsun1106 commented on a change in pull request #1496: GROOVY-6360: move @Pure to separate subproject.

Posted by GitBox <gi...@apache.org>.
danielsun1106 commented on a change in pull request #1496:
URL: https://github.com/apache/groovy/pull/1496#discussion_r580819038



##########
File path: src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
##########
@@ -190,6 +191,15 @@ public static boolean trySetAccessible(final AccessibleObject ao) {
         return false;
     }
 
+    public static boolean hasAnnotationWithSimpleName(AccessibleObject obj, String simpleName) {

Review comment:
       Both `@groovy.annotations.Pure` and `@foo.bar.Pure` have same simple name `Pure`. If user uses `@foo.bar.Pure` to mark methods, which will be treated as "pure" methods too.
   
   So I recommend using full class name instead of simple name.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] paulk-asert commented on pull request #1496: GROOVY-6360: move @Pure to separate subproject.

Posted by GitBox <gi...@apache.org>.
paulk-asert commented on pull request #1496:
URL: https://github.com/apache/groovy/pull/1496#issuecomment-783140245


   Draft, still needs some work.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [groovy] paulk-asert commented on a change in pull request #1496: GROOVY-6360: move @Pure to separate subproject.

Posted by GitBox <gi...@apache.org>.
paulk-asert commented on a change in pull request #1496:
URL: https://github.com/apache/groovy/pull/1496#discussion_r580929814



##########
File path: src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
##########
@@ -190,6 +191,15 @@ public static boolean trySetAccessible(final AccessibleObject ao) {
         return false;
     }
 
+    public static boolean hasAnnotationWithSimpleName(AccessibleObject obj, String simpleName) {

Review comment:
       I haven't worked out a way to make it extensible without making it ugly.
   
   And my next goal will be to write a purity type checker extension which would hopefully be able to be made to work with any of the above. Although I can think of a few options for this second use case.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org