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

  • Home
  • SEARCH
  • 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 8244753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:57:35+00:00 2026-06-07T21:57:35+00:00

I need to instantiate a function passed as a string, and i wrote a

  • 0

I need to instantiate a function passed as a string, and i wrote a wrapper for a “Function” object that let me execute the function after it’s defined.

The wrapper uses the JavaAssist library, using object and method as fields of the wrapper object and a method that let me use the function outside the wrapper class.

My troubles are about the function body syntax, i have a lot of
java.lang.VerifyError: (class: MyClass, method: myMethod signature: (*my signature, unimportant *) Expecting to find *a primitive type* on stack

related to casts on the fly, for example

 Double c = (double) intVariable;

which I solved (not really good solution, but it is working) avoiding those casting and always instantiating variables of the defined type

 Double c = new Double( (String) intVariable.toString() );

Now I have another problem, and it’s driving me crazy: this is the content of the string

Double t2 =  new Double ( (String) parametri.get("pigreco").toString() );
Double t3 = new Double ( (String) (new Integer(2)).toString() );";
Double mysum = t2;
mysum+= t3;
return my sum;

t2.getClass() and t3.getClass() return java.lang.Double
but mysum is the concatenation of t2 and t3, not the arithmetic sum… how come is it possible?

  • 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-06-07T21:57:36+00:00Added an answer on June 7, 2026 at 9:57 pm

    For now I have resolved by providing a

    public static Double sommaDouble(Double a, Double b) {
        return a+b;
    }
    

    in another class. Im looking for a better solution, and I’d like to understand why the “+” is executed as the concatenate operator by Javaassist’s method

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

Sidebar

Related Questions

I need to instantiate a singleton object per web request, so that the data
I need to instantiate a char[16384] buffer before calling a c function. After the
I have a function that uses reflection to set properties of object A from
Need help with a query that I wrote: I have three tables Company id
I have instantiated an object like this: GraphMatrixDirected<String, Integer> g g is passed to
I need to be able to instantiate an object of a class in Dojo
If one uses autoloader function (with spl_autoload_register), does one need anymore: singleton: all needed
I have two classes that each need an instance of each other to function.
Aloha, I have a custom control that I need to instantiate from within a
I'm unsuccessfully attempting to instantiate a reference of a class that is passed as

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.