groovy

class generation does not enforce the "implements" keyword

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0-JSR-5
  • Fix Version/s: 1.0-JSR-6
  • Component/s: class generator
  • Labels:
    None
  • Environment:
    WindowsXP/SP2 + jdk1.5.0_05
  • Number of attachments :
    0

Description

The following program does not generate error:

class Person {
@Property String firstName
@Property String lastName
@Property int id

String toString() {"${firstName} ${lastName} has id ${id}"}
}

interface PersonService {
Person[] getPersons()

Person findPerson( int id)
}

class PersonServiceImpl implements PersonService {
private List persons = new ArrayList()

PersonServiceImpl() { persons = [ new Person(firstName:"Guillaume", lastName:"Laforge", id:0), new Person(firstName:"Jochen", lastName:"Theodorou", id:1), new Person(firstName:"Dierk", lastName:"Koenig", id:2)] }

Person findPerson(int id) { return persons[id] }

}

Class[] ati = PersonServiceImpl.class.getInterfaces()
ati.each{println "-> $it" }
println PersonServiceImpl.name
ps = new PersonServiceImpl()
println ps.findPerson(2)

Activity

Hide
blackdrag blackdrag added a comment -

looks like the vm does not enforce you to make a class abstract if you don't implement all methods form the interface... Anyway, it should be fixed now

Show
blackdrag blackdrag added a comment - looks like the vm does not enforce you to make a class abstract if you don't implement all methods form the interface... Anyway, it should be fixed now

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: