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 5964199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:23:17+00:00 2026-05-22T19:23:17+00:00

I have been trying to generate some dynamic codes (Using Javassist) but program fails

  • 0

I have been trying to generate some dynamic codes (Using Javassist) but program fails at a certain point when involving a double array or float array. The code is as follows

Class c = Customers.class; // called in main & Customer class just has a double[] Dubs = new double[10]
CreateType(c); // Main


public static Object CreateType(Class genericType)
{
        // some preReq declarations
        CtMethod writeCode = dyn.getDeclaredMethod("processCode");

        generateCode(genericType, Code, "temp"); // Code is a StringBuilder class

        System.out.println(Code);

        writeCode.insertAt(1, Code.toString()); // Compilation is successful

        Class c = dyn.toClass();

        Dynamic h;
        Constructor[] ctorlist = null;

        ctorlist =  c.getDeclaredConstructors(); // Problem is here

        h = (DynamicSurrogate) ctorlist[0].newInstance(genericType);

        return h;
}

Generated code is as follows

    testapp1.Customers temp=(testapp1.Customers)graph;
    output.processDouble(temp.Dubs[1]);

But problem arises when getDeclaredConstructors is called c.getDeclaredConstructors() … it throws the following error

Exception in thread “main” java.lang.VerifyError: (class: testapp1/Dyn, method: processDouble signature: (Lsomething/Output;Ljava/lang/Object;)V) Inconsistent args_size for opc_invokeinterface

A workaround exists but does not make any sense, i.e. everything works fine if i simply create a copy of the double array and pass it on to processDouble in dynamic code
i.e. if the dynamic code is

    testapp1.Customers temp=(testapp1.Customers)graph;
    double[] d = temp.Dubs;
    output.processDouble(d);

In short , exception Unhandled is thrown by getDeclaredConstructor but it actually has nothing to do with a constructor because it doesnt matter if i create one or not

Hopefully my problem and code is clear enough, if any confusion please do tell, Thankyou in advance 🙂

  • 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-22T19:23:19+00:00Added an answer on May 22, 2026 at 7:23 pm

    The verify error is thrown out of getDeclaredConstructors because that’s the first place that the bytecodes in class c are verified.

    As to the cause of the error, I suspect it has to do with the fact that in the first case you’re passing a double, and in the second case a double[].

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

Sidebar

Related Questions

I have been trying to create some dynamic Xaml. I have the following c#
I've been trying my hand at optimising some code I have using microsoft's sse
I have been trying to generate a heatmap in R for some microarray data
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I have been trying to make a case for using Python at my work.
I have been Trying to figure this out for some time now. I have
I have been trying to tackle this problem , but I am having difficulty
I have been wrestling with SvcUtil all day, trying to get it to generate
I edited some mistakes and details... Well, I have been trying to create a
I'm trying to generate a dynamic property in a framework I'm using, and I'm

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.