Permalink
Browse files

introduced @Contracted annotation

  • Loading branch information...
1 parent bc8de20 commit 002740c9095fba1fbd45324151e62e4f5c166117 @andresteingress committed Mar 10, 2011
Showing with 109 additions and 89 deletions.
  1. +2 −2 gcontracts-core/src/main/java/org/gcontracts/annotations/{EnableAssertions.java → Contracted.java}
  2. +2 −3 gcontracts-core/src/main/java/org/gcontracts/ast/GContractsASTTransformation.java
  3. +9 −9 ...acts-core/src/test/groovy/org/gcontracts/tests/annotationcontracts/AnnotationContractTests.groovy
  4. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/doc/DocumentationExampleTests.groovy
  5. +1 −1 gcontracts-core/src/test/groovy/org/gcontracts/tests/doc/RootClassExampleTests.groovy
  6. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/doc/StackExampleTests.groovy
  7. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/interfaces/AbstractClassInheritanceTests.groovy
  8. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/interfaces/AbstractClassTests.groovy
  9. +4 −4 ...s-core/src/test/groovy/org/gcontracts/tests/interfaces/InterfaceAbstractClassMixturesTests.groovy
  10. +4 −4 ...racts-core/src/test/groovy/org/gcontracts/tests/interfaces/SimpleInterfaceInheritanceTests.groovy
  11. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/interfaces/StackExampleTests.groovy
  12. +15 −13 gcontracts-core/src/test/groovy/org/gcontracts/tests/inv/InheritanceTests.groovy
  13. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/inv/POGOClassInvariantTests.groovy
  14. +3 −3 gcontracts-core/src/test/groovy/org/gcontracts/tests/inv/SimpleClassInvariantTests.groovy
  15. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/other/AbstractClassTests.groovy
  16. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/other/CircularAssertionCallTests.groovy
  17. +26 −3 ...c/test/groovy/org/gcontracts/tests/other/{AssertionsEnabledTests.groovy → ContractedTests.groovy}
  18. +1 −1 gcontracts-core/src/test/groovy/org/gcontracts/tests/other/MissingLineNumberTests.groovy
  19. +1 −1 ...cts-core/src/test/groovy/org/gcontracts/tests/post/ImplicitVariableNamesPostconditionTests.groovy
  20. +4 −4 gcontracts-core/src/test/groovy/org/gcontracts/tests/post/InheritanceTests.groovy
  21. +1 −1 gcontracts-core/src/test/groovy/org/gcontracts/tests/post/OldVariablePostconditionTests.groovy
  22. +1 −1 ...acts-core/src/test/groovy/org/gcontracts/tests/post/ResultAndOldVariablePostconditionTests.groovy
  23. +1 −1 gcontracts-core/src/test/groovy/org/gcontracts/tests/post/ResultVariablePostconditionTests.groovy
  24. +1 −1 gcontracts-core/src/test/groovy/org/gcontracts/tests/post/SimplePostconditionTests.groovy
  25. +2 −2 gcontracts-core/src/test/groovy/org/gcontracts/tests/pre/InheritanceTests.groovy
  26. +1 −1 gcontracts-core/src/test/groovy/org/gcontracts/tests/pre/SimplePreconditionTests.groovy
  27. +1 −1 gcontracts-core/src/test/groovy/org/gcontracts/util/AnnotationUtilsTests.groovy
  28. +0 −5 gcontracts-doc/build.gradle
  29. +2 −2 {gcontracts-spring → gcontracts-grails}/build.gradle
  30. +1 −1 ...cts/spring → gcontracts-grails/src/main/java/org/gcontracts/grails}/SpringContractsLifecycle.java
  31. +1 −0 gcontracts-grails/src/main/resources/META-INF/services/org.gcontracts.common.spi.Lifecycle
  32. +1 −1 ...gcontracts/spring → gcontracts-grails/src/test/groovy/org/gcontracts/grails}/BaseTestClass.groovy
  33. +4 −4 ...ng → gcontracts-grails/src/test/groovy/org/gcontracts/grails}/SimpleSpringIntegrationTests.groovy
  34. +2 −1 ...g → gcontracts-grails/src/test/groovy/org/gcontracts/grails}/SpringContractsLifecycleTests.groovy
  35. +1 −0 gcontracts-grails/src/test/resources/META-INF/services/org.gcontracts.common.spi.Lifecycle
  36. +0 −1 gcontracts-spring/src/main/resources/META-INF/services/org.gcontracts.common.spi.Lifecycle
  37. +0 −1 gcontracts-spring/src/test/resources/META-INF/services/org.gcontracts.common.spi.Lifecycle
  38. +1 −1 settings.gradle
@@ -33,7 +33,7 @@
*
* For example:
* <pre>
- * &#064;EnableAssertions
+ * &#064;Contracted
* package my.package
*
* import org.gcontracts.annotations.*
@@ -43,4 +43,4 @@
*/
@Target({ElementType.PACKAGE, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
-public @interface EnableAssertions {}
+public @interface Contracted {}
@@ -27,7 +27,7 @@
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.control.io.ReaderSource;
import org.codehaus.groovy.transform.GroovyASTTransformation;
-import org.gcontracts.annotations.EnableAssertions;
+import org.gcontracts.annotations.Contracted;
import org.gcontracts.ast.visitor.*;
import org.gcontracts.common.spi.ProcessingContextInformation;
import org.gcontracts.generation.CandidateChecks;
@@ -78,7 +78,6 @@ public void visit(ASTNode[] nodes, SourceUnit unit) {
final ConfiguratorSetupVisitor configuratorSetupVisitor = new ConfiguratorSetupVisitor(unit, source);
for (final ClassNode classNode : moduleNode.getClasses()) {
- // there is nothing to do for interfaces
if (!CandidateChecks.isContractsCandidate(classNode)) continue;
final ProcessingContextInformation pci = createProcessingContextInformation(classNode, unit, source);
@@ -97,7 +96,7 @@ public void visit(ASTNode[] nodes, SourceUnit unit) {
}
private ProcessingContextInformation createProcessingContextInformation(ClassNode classNode, SourceUnit unit, ReaderSource source) {
- final ClassNode assertionsEnabledClassNode = ClassHelper.makeWithoutCaching(EnableAssertions.class);
+ final ClassNode assertionsEnabledClassNode = ClassHelper.makeWithoutCaching(Contracted.class);
final List<AnnotationNode> annotationsPackage = classNode.getPackage() != null ? classNode.getPackage().getAnnotations(assertionsEnabledClassNode) : Collections.<AnnotationNode>emptyList();
final List<AnnotationNode> annotationsClassNode = classNode.getAnnotations(assertionsEnabledClassNode);
@@ -31,7 +31,7 @@ class AnnotationContractTests {
'''
def source = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -69,7 +69,7 @@ class AnnotationContractTests {
'''
def source = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -107,7 +107,7 @@ class AnnotationContractTests {
'''
def source = '''
- @EnableAssertions
+ @Contracted
package tests
class Tester {
@@ -128,7 +128,7 @@ class AnnotationContractTests {
void requires_method() {
def source = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -172,7 +172,7 @@ class AnnotationContractTests {
'''
def source = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -209,7 +209,7 @@ class AnnotationContractTests {
'''
def source = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -256,7 +256,7 @@ class AnnotationContractTests {
'''
def source = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -277,7 +277,7 @@ class AnnotationContractTests {
void ensures_method() {
def source = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -311,7 +311,7 @@ class AnnotationContractTests {
void class_invariant() {
def source = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -13,7 +13,7 @@ class DocumentationExampleTests extends BaseTestClass {
def example_person = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -33,7 +33,7 @@ class Person {
'''
def example_eiffel_stack = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -11,7 +11,7 @@ import static org.junit.Assert.*;
class RootClassExampleTests extends BaseTestClass {
def source = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -9,7 +9,7 @@ import org.junit.Test
class StackExampleTests extends BaseTestClass {
def source_stack = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -70,7 +70,7 @@ class Stack {
'''
def source_stack_descendant = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -10,7 +10,7 @@ import org.junit.Test
class AbstractClassInheritanceTests extends BaseTestClass {
def source_stackable = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -26,7 +26,7 @@ abstract class Stackable {
'''
def source_stack = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -10,7 +10,7 @@ import org.junit.Test
class AbstractClassTests extends BaseTestClass {
def source_stackable = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -26,7 +26,7 @@ abstract class Stackable {
'''
def source_stack = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -13,7 +13,7 @@ class InterfaceAbstractClassMixturesTests extends BaseTestClass {
@Test void class_with_abstract_class_and_interface() {
def s1 = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -29,7 +29,7 @@ class InterfaceAbstractClassMixturesTests extends BaseTestClass {
'''
def s2 = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -50,7 +50,7 @@ class InterfaceAbstractClassMixturesTests extends BaseTestClass {
@Test void interface_and_abstract_class_both_contain_abstract_methods() {
def s1 = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -67,7 +67,7 @@ class InterfaceAbstractClassMixturesTests extends BaseTestClass {
'''
def s2 = '''
- @EnableAssertions
+ @Contracted
package tests
import org.gcontracts.annotations.*
@@ -9,7 +9,7 @@ import org.junit.Test
class SimpleInterfaceInheritanceTests extends BaseTestClass {
def source_stackable = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -23,7 +23,7 @@ abstract class Stackable {
'''
def source_stack = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -52,7 +52,7 @@ class Stack extends Stackable {
'''
def source_implicit_interface = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -74,7 +74,7 @@ class C extends B {
'''
def source_implicit_interface2 = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -11,7 +11,7 @@ import static org.junit.Assert.*;
class StackExampleTests extends BaseTestClass {
def source_stackable = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
@@ -27,7 +27,7 @@ interface Stackable {
'''
def source_stack = '''
-@EnableAssertions
+@Contracted
package tests
import org.gcontracts.annotations.*
Oops, something went wrong.

0 comments on commit 002740c

Please sign in to comment.