Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Incomplete
-
2.1.3
-
None
-
None
-
Ubuntu 12.04, Oracle Java 1.7.17, Groovy 2.1.3, Maven 3.0.4
Description
I don't know if this is a regression or if GROOVY-2897 was never properly vetted, but I think this issue needs to be looked at again. I have a Maven project, and I'm using:
<build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <version>2.7.0-01</version> </dependency> </dependencies> <configuration> <compilerId>groovy-eclipse-compiler</compilerId> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <artifactId>groovy-eclipse-compiler</artifactId> <groupId>org.codehaus.groovy</groupId> <version>2.7.0-01</version> <extensions>true</extensions> </plugin> </plugins> </build>
and
<dependencies> <dependency> <artifactId>groovy-all</artifactId> <groupId>org.codehaus.groovy</groupId> <version>2.1.3</version> </dependency> </dependencies>
and I have a Java interface which has these 2 properties defined at least:
/** * Gets the password used by the parser if not in guest mode. * @return */ String getPassword(); /** * Sets the password used by the parser if not in guest mode. * @param password */ void setPassword(String password); /** * Gets whether the parser should be in guest mode or not if one exists. * @return */ boolean isUsingGuestAccount(); /** * Sets whether the parser should be in guest mode or not if one exists. * @param val */ void setUsingGuestAccount(boolean val);
I then have an abstract Groovy class between this interface and other implementations which implements these properties. For the password property all I need is:
String password
and the compilation is fine. However, for the boolean property I must implement the methods directly as:
@Override public boolean isUsingGuestAccount(){ return usingGuestAccount } @Override public void setUsingGuestAccount(final boolean usingGuestAccount){ this.usingGuestAccount = usingGuestAccount }
because if I try use:
boolean usingGuestAccount
then I get compiler errors just as the original poster of issue GROOVY-2897 that the class is not abstract and does not implement the abstract method. This is very inconsistent.