nhatminhle / cofoja

Contracts for Java
GNU Lesser General Public License v3.0
151 stars 18 forks source link

Contract not showing error.... for undefined symbol.... #30

Closed nhatminhle closed 10 years ago

nhatminhle commented 10 years ago

From sagarf...@gmail.com on July 12, 2011 11:25:10

What steps will reproduce the problem? 1. load the program Contracts.java

  1. it doesn't give any error for invalid/not defined variable c
  2. I have added the cofoja-latest.jar and asm-all-3.3.1.jar to build path of project.
  3. Also, followed steps mentioned on http://fsteeg.com/2011/02/07/setting-up-contracts-for-java-in-eclipse/#comment-228 What is the expected output? What do you see instead? It should give error in Contract.java for undefined symbol c. What version of the product are you using? On what operating system? eclipse 3.6.1 , vista os. Please provide any additional information below. Contracts.java program that I have loaded.

package temp; import com.google.java.contract.Ensures; import com.google.java.contract.Requires;

public class Contracts{ public static void main(String[] args) {

    System.out.println(new Numbers().add(-10, 5));

}

}

class Numbers {

@Requires({ "c > 0", "b > 0" })   // not giving error for var. c                   

@Ensures({ "result > a", "result > b" })

int add(int a, int b) {

    return a - b;

}

}

Original issue: http://code.google.com/p/cofoja/issues/detail?id=27

nhatminhle commented 10 years ago

From nhat.min...@gmail.com on July 12, 2011 12:58:00

Hi, does it build contracts nonetheless? Most probably, I would say the annotation processor is not run at all on the class. Is that Eclipse-specific? Can you try it from the command-line? Thanks.

nhatminhle commented 10 years ago

From sagarf...@gmail.com on July 12, 2011 15:08:54

The above program when executed gives me output -15. which is result of -10 - 5 . I dont get any error for undefined symbol c. I have also attached the annotation and factory path setting GUI window for your reference. Kindly help.

regards sagar sagarfree@gmail.com

Attachment: AnnotationProcessingWindow.jpg factoryPathWindow.jpg

nhatminhle commented 10 years ago

From chat...@google.com on August 03, 2011 04:25:53

Issue 26 has been merged into this issue.

nhatminhle commented 10 years ago

From alexl...@gmail.com on October 14, 2011 14:56:47

works for me, I had some problems setting up Eclipse though.

make sure the jar files are really present and the annotation processor runs.

nhatminhle commented 10 years ago

From nhat.min...@gmail.com on August 17, 2014 14:26:11

Status: Invalid