-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"notify" field name does not compile #42
Comments
I think that is best to fix in the same style as here #21 |
In addition, it will be necessary to correct all the names of the methods java.lang.Object |
The temporary workaround is to use Gradle example: plugins {
id("io.github.ermadmi78.kobby") version "4.0.1"
}
kobby {
kotlin {
entity {
projection {
withPrefix = "with"
}
}
}
} Maven example: <plugin>
<groupId>io.github.ermadmi78</groupId>
<artifactId>kobby-maven-plugin</artifactId>
<version>4.0.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate-kotlin</goal>
</goals>
<configuration>
<kotlin>
<entity>
<projection>
<withPrefix>with</withPrefix>
</projection>
</entity>
</kotlin>
</configuration>
</execution>
</executions>
</plugin> This plugin setting will add "with" prefix to all generated projection methods. |
The problem is reproduced for all names that match
To fix this problem, Kobby will automatically add prefix "__" to all forbidden projection names. For example, for type: type Query {
getClass: Boolean!
hashCode: Boolean!
equals: Boolean!
clone: Boolean!
toString: Boolean!
notify: Boolean!
notifyAll: Boolean!
wait: Boolean!
finalize: Boolean!
normal: Boolean!
} Kobby will generate projection: public interface QueryProjection {
public fun __getClass(): Unit
public fun __hashCode(): Unit
public fun __equals(): Unit
public fun __clone(): Unit
public fun __toString(): Unit
public fun __notify(): Unit
public fun __notifyAll(): Unit
public fun __wait(): Unit
public fun __finalize(): Unit
public fun normal(): Unit
public fun __minimize(): Unit {
}
} |
Fixed in release 4.0.3 |
STR:
mvn clean kobby:generate-kotlin && mvn clean compile
Expected
No errors
Actual
[ERROR] .../src/main/kotlin/generated/entity/Thing.kt: (44, 3) Accidental override: The following declarations have the same JVM signature (notify()V):
fun notify(): Unit defined in generated.entity.ThingProjection
[ERROR] .../src/main/kotlin/generated/entity/impl/ThingImpl.kt: (116, 3) Accidental override: The following declarations have the same JVM signature (notify()V):
fun notify(): Unit defined in generated.entity.impl.ThingProjectionImpl
Problem seems to be with creating projections of fields that are with same name as java.lang.Object functions.
Possible workaround currently is to prefix all projection fields
but this looks ugly in the end.
The text was updated successfully, but these errors were encountered: