nhatminhle / cofoja

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

Constructors with arguments narrower than int prevent contracting of child classes #11

Closed nhatminhle closed 10 years ago

nhatminhle commented 10 years ago

From nhat.min...@gmail.com on November 01, 2010 07:54:57

Incorrect stubbing code are generated for the super constructor call. The following code does not compile with the contract compiler:

private static class Ch { @Requires("x != '\0'") public Ch(char x) { } }

@Contracted private static class Chx extends Ch { public Chx(char x) { super(x); } }

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

nhatminhle commented 10 years ago

From nhat.min...@gmail.com on November 01, 2010 08:04:21

The following patch should fix it. In particular, it should now be able to compile com.google.gdata.util.common.base.CharEscapers. Review pending.

Status: Started
Cc: davidmor...@google.com

nhatminhle commented 10 years ago

From nhat.min...@gmail.com on November 01, 2010 08:05:03

Errr, forgot patch...

Attachment: 0001-Add-failing-test-for-bug-4-super-constructors-with-a.patch 0002-Add-cast-to-default-values-in-generated-stubs-fix-bu.patch

nhatminhle commented 10 years ago

From davidmor...@google.com on November 02, 2010 02:02:30

LGTM

Thanks!

nhatminhle commented 10 years ago

From nhat.min...@gmail.com on November 02, 2010 03:02:14

Committed in r57 .

Status: Fixed