nhatminhle / cofoja

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

Contracts cannot be added to a method that throws a type parameter #9

Closed nhatminhle closed 9 years ago

nhatminhle commented 9 years ago

From nhat.min...@gmail.com on November 01, 2010 04:28:39

The following class crashes the contract compiler:

class T { @Requires("true") public void f(X x) throws X { throw x; } }

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

nhatminhle commented 9 years ago

From nhat.min...@gmail.com on November 01, 2010 05:15:32

In the previous example code, X should extend Throwable.

nhatminhle commented 9 years ago

From nhat.min...@gmail.com on November 01, 2010 05:20:24

The following patch against r52 should fix the bug. Pending review.

Attachment: 0001-Add-failing-test-for-bug-1-type-parameter-in-throws-.patch 0002-Relax-MethodModel-exception-list-to-hold-TypeName-ob.patch

nhatminhle commented 9 years ago

From davidmor...@google.com on November 01, 2010 06:13:49

LGTM

nhatminhle commented 9 years ago

From nhat.min...@gmail.com on November 01, 2010 06:20:10

Fixed in r55 .

Status: Fixed