Fwd: Block and Expression Annotations

Mani Sarkar sadhak001 at gmail.com
Wed Feb 1 23:14:28 UTC 2017


Great opportunity for everyone on this list to help Ivan out.

Please spread the word into other communities.

Cheers,
Mani

---------- Forwarded message ---------
From: Ivan Paterno <ivan.paterno.mailinglist at gmail.com>
Date: Wed, 1 Feb 2017 at 23:05
Subject: Block and Expression Annotations
To: <jdk9-dev at openjdk.java.net>



Hi all,

I'm working on a change to the compiler/reflection library to handle
Annotation on two new ElementType: EXPRESSION and BLOCK.

Here are some basic examples to explain what i mean:

First on EXPRESSION annotation

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target(ElementType.EXPRESSION)
@interface Test {}

public class SimpleExpression {

     private int field1;
     private static int field2;
     private int field3 = 0;

     public SimpleExpression() {
         this.field1 = @Test() {1};
         field2 = this.field1 + @Test() {2};
         this.field3 = @Test() {this.field1 + @Test() {field2}};
     }

}

And on BLOCK:

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target(ElementType.BLOCK)
@interface Test {

     String someValue() default "";

}

public class WhileLoop {

     private int a;

     public WhileLoop(int c) {
         @Test() {
             while (c != 0) {
                 this.a += c;
                 c--;
             }
         }
     }
}


There are very basic example but i have a lot of tests added to my local
repository. Obviusly i need to create many others to cover the various
possibilities.

Anybody want to help me make these tests?

If someone is interested in the paper about this features, this is the link:

Walter Cazzola and Edoardo Vacchi, @Java: Annotations in Freedom, in
Proceedings of 28th Annual ACM Symposium on Applied Computing (SAC'13),
Coimbra, Portugal, March 2013, ACM Press


Thanks,

Ivan Paterno

-- 
@theNeomatrix369 <http://twitter.com/theNeomatrix369>*  |  **Blog
<http://neomatrix369.wordpress.com/>**  |  *LJC Associate & LJC Advocate
(@adoptopenjdk & @adoptajsr programs)
*Meet-a-Project - *MutabilityDetector
<https://github.com/MutabilityDetector>*  |  **Bitbucket
<https://bitbucket.org/neomatrix369>* * |  **Github
<https://github.com/neomatrix369>* * |  **LinkedIn
<http://uk.linkedin.com/pub/mani-sarkar/71/a77/39b>*
*Come to Devoxx UK 2017:* http://www.devoxx.co.uk/

*Don't chase success, rather aim for "Excellence", and success will come
chasing after you!*


More information about the adoption-discuss mailing list