Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6116887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:15:28+00:00 2026-05-23T15:15:28+00:00

I am writing a Clojure class using gen-class . I have a state field

  • 0

I am writing a Clojure class using gen-class. I have a “state” field that I am trying to access in the following code:

(ns com.example.sparetime.DateButton
  (:gen-class
    :extends javax.swing.JToggleButton
    :init initialize
    :state state
    :constructors {[Integer] [String]})
  (:import
    [java.awt Insets]))

(if *compile-files*
  (set! *warn-on-reflection* true))

(def insets (Insets. 1 1 1 1))

(defn -initialize [day-number]
  [[(Integer/toString day-number)] day-number])

(defn get-day-number [this]
  (.state this))

(defn -getInsets [this]
  insets)

I get a reflection warning on the line containing (.state this). I tried adding a type hint with (.state ^DateButton this), but then I get a compilation error that the compiler is unable to resolve DateButton (chicken and egg? Datebutton does not exist until the compiler finishes compiling this file).

Never mind the wisdom of type hinting this code. How do I do it? Do I need to fully qualify the DateButton package?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:15:29+00:00Added an answer on May 23, 2026 at 3:15 pm

    You have to import your class or fully qualify its name. Then the ^DateButton hint will work and eliminate the reflection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some Clojure code that depends upon a number of constants. They will
I am writing a Clojure macro that accepts a description of a panel using
I have a Java class that has access to a transaction context that I'd
I am considering writing a REST Server using Clojure. I have experience using RESTEasy
I am writing a small Clojure project using leiningen with the following directory structure:
Writing documentation in html requires some code examples. What to do with characters that
I have a group of numeric functions in Clojure that I want to validate
I need to add several methods to a Clojure defprotocol that I am writing
I am writing a function for my Clojure program that reads user input from
I'm creating a library that includes both Clojure and Java code, and would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.