No way to AOT class with interface or parent whose fully qualified name doesn't contain a period

Description

I'm trying to interop with some java code. I have a class files in a jar that contains an interface called `Player` which I can't modify. The issue is that a bare name like this automatically has java.lang prepended to it by the gen-class macro. My ns looks something like

(ns PlayerAI
(:gen-class :implements [Player]))

which throws an error

java.lang.ClassNotFoundException: java.lang.Player, compilingPlayerAI.clj:1:1)

There is no way to avoid this based on what I see in the source here.

Environment

None

Activity

Show:
import
March 30, 2017, 5:54 AM

Comment made by: matan

when AOT compiling

import
March 30, 2017, 5:53 AM

Comment made by: matan

That same line of code pointed at above, might be involved in causing something tentatively more like a terrible usability bug. Consider gen-classing a Java interface:

(ns org.boteval.samples.driver
(:import [org.boteval.api.ApiInterface])
(:gen-class
:implements [org.boteval.api.ApiInterface]
:methods
[
[initScenario [String] void]
[send [String] void]
]))

if the void return type is not specified, for the methods, we get a cryptic:

java.lang.ClassNotFoundException: java.lang.

Obviously this is for a separate ticket...

Stuart Halloway
July 21, 2015, 2:24 PM

Using the default package is a terrible practice and I don't think Clojure should encourage it.

Declined
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Unassigned

Reporter

import

Labels

Priority

Minor

Affects versions