This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Is there already a issue in Clojure's Jira where I can follow about implementations of interfaces with gen-class
not generating default methods?
Why would you need that? Do you mean methods that override default methods?
I guess, I don’t understand what you’re trying to do
when using gen-class https://github.com/clojure-lsp/clojure-lsp-intellij/blob/master/src/main/clojure/com/github/clojure_lsp/intellij/extension/commenter.clj#L15 for example, if I don't implement getLineCommentPrefixes
which is a default method https://github.com/JetBrains/intellij-community/blob/idea/232.8660.185/platform/core-api/src/com/intellij/lang/Commenter.java#L36, I get a UnsuportedOperationException when that generated class is used (and calls that method)
to workaround that, I implement the default method and do the same is done in the default
interface
I prefer use gen-class when I need to call other clojure namespaces, but yeah, gen-class is tricky
linking the AskClojure https://ask.clojure.org/index.php/13178/why-gen-class-does-not-generate-default-interface-methods
Created a https://github.com/ericdallo/clojure-sample/tree/clojure-gen-class-default-method which easily repro the problem
Hey @U064X3EF3, just to let you know, I took a look at Clojure code and managed to create a test + a possible one line fix :) From what I understood from the contribution guidelines I should wait for the vetted + release scheduling to provide a dev patch right? (already signed the contributor agreement) LMK if I'm missing anything, would love to contribute to Clojure :)
you can supply a patch now, per https://clojure.org/dev/dev#_becoming_a_contributor - there's a link there to request a contributor account
Hey @U064X3EF3 I hope it's ok to ask here, any tips on how to fill this https://github.com/ericdallo/Clojure/blob/CLJ-2794/src/clj/clojure/genclass.clj#L419 local, I want to know if the user defined a function for that genclass, but not sure I can use a resolve
or something there (I hope I don't need to use the GeneratorAdapter instructions, that looks complex 😅)
I know I can (var-name mname)
to the the var name, but how to check if that is really bound in user's code
Yeah, I think it will be required to add a instruction that checks if the var isBound
and then add or not the method
don't have time to look atm, if you get stuck, just update the ticket with where you're stuck
thx, will probably not look at it until after 1.12 as we are trying to start closing things down towards a release