ebean-orm-tools / finder-generator

Code generator for avaje-ebeanorm-typequery
Apache License 2.0
2 stars 3 forks source link

kotlin generator bug #26

Closed BrettCao closed 4 years ago

BrettCao commented 5 years ago

Lack of body open class UserFinder : Finder<Long, User>(User::class.java) { } ....

rbygrave commented 5 years ago

What is the problem with that? Refactor adding a function ... will add the body braces etc.

BrettCao commented 5 years ago

Missing body braces now

rbygrave commented 5 years ago

Yes that is correct and intended.

So what is the problem? Are you unable to compile or something?

BrettCao commented 5 years ago

Yes,If missing {}: Error:(14, 30) Kotlin: Unresolved reference: db

BrettCao commented 5 years ago

Unable to compile

rbygrave commented 5 years ago

This doesn't really make sense to me. Show me all the code for the file/class that is unable to compile. Does it not contain a method that you added? When you added it you didn't add the brackets for the body for some reason?

BrettCao commented 5 years ago

Missing “{}” when auto-generated Finder, now need to be manually added to compile

BrettCao commented 5 years ago

@Override public void finderClass(FileWriter writer, String shortName, String idTypeShortName) throws IOException {

//open class AddressFinder : Finder<Long, Address>(Address::class.java)

writer.append("open class ").append("").append(shortName).append("Finder")
  .append(" : Finder<").append(idTypeShortName).append(", ")
  .append(shortName).append(">(").append(shortName).append("::class.java)")
  .append(NEWLINE);

}

to

@Override public void finderClass(FileWriter writer, String shortName, String idTypeShortName) throws IOException {

//open class AddressFinder : Finder<Long, Address>(Address::class.java)

writer.append("open class ").append("").append(shortName).append("Finder")
  .append(" : Finder<").append(idTypeShortName).append(", ")
  .append(shortName).append(">(").append(shortName).append("::class.java){")
  .append(NEWLINE);

}

@Override public void finderClassEnd(FileWriter writer) throws IOException { writer.append("}").append(NEWLINE); }

rbygrave commented 5 years ago

Yeah, I still don't understand.

I think you are saying

open class AddressFinder : Finder<Long, Address>(Address::class.java)

The above does not compile. For me it does compile, it is valid Kotlin.

rbygrave commented 4 years ago

I think this issue is likely to be the same as https://github.com/ebean-orm-tools/finder-generator/pull/30

So I guess we can close this.