Search code examples
javajsonaspectjspring-roo

@RooWebJson Generates Invalid Aspect File


I have a simple object:

@RooJavaBean
@RooToString
@RooJpaActiveRecord
@RooJson
public class HJAddress {
    private String id;

}

And a simple, empty controller:

@RooWebJson(jsonObject = HJAddress.class)
@Controller
@RequestMapping("/hjaddresses")
public class HJAddressController {

}

The .aj files Roo generates for the controllers are fine, except for the end of the deleteFromJson method. It always generates a compiler error for me. Looking at it, it does:

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, headers = "Accept=application/json")
public ResponseEntity<String> HJAddressController.deleteFromJson
        (@PathVariable("id") Long id) {
    HJAddress hJAddress = HJAddress.findHJAddress(id);
    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/json");
    if (hJAddress == null) {
        return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
    }
>>> HJAddress_.remove();
    return new ResponseEntity<String>(headers, HttpStatus.OK);
}

And right at the end there, it says HJAddress_.remove() instead of hJAddress.remove(). All of the other methods do indeed use this HJAddress_ naming scheme.

I'm not really sure where to go from here since it's something internal to Roo.

EDIT: This is using roo 1.2 with STS based on eclipse indigo.


Solution

  • Apparently it is a bug in Roo 1.2 that is getting fixed in 1.2.1.

    http://forum.springsource.org/showthread.php?122911-RooWebJson-Generates-Invalid-Aspect-Files&p=400871#post400871