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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:56:13+00:00 2026-05-24T18:56:13+00:00

How do I in BCEL check for this.. Say the bytecode in java is

  • 0

How do I in BCEL check for this..

Say the bytecode in java is

newarray 10 (int)

I got this already done for visitor

instruction instanceof NEWARRAY

public boolean visit(Instruction instr) {
    return instr instanceof NEWARRAY;
}

But I also have to check if the newarray is int[]

how do I check this in BCEL?

I tried this

 && ((NEWARRAY) instr).getType() == Type.INT;

to well

return instr instanceof NEWARRAY && ((NEWARRAY) instr).getType() == Type.INT;

But you can see the above ^ will not work as it will never be int.. but int[]

But Type.INT is just int.. and not int[]..

How I represent Type int[]?

I was reading the BCEL source code and NEWARRAY.getType() returns this..

     /**
      * @return type of constructed array
      */
     public final Type getType() {
         return new ArrayType(BasicType.getType(type), 1);
     }

As you can see it returns a Type class so.. looking at
http://commons.apache.org/bcel/apidocs/org/apache/bcel/generic/Type.html

http://commons.apache.org/bcel/apidocs/org/apache/bcel/generic/ArrayType.html

there isn’t any Type‘s for ARRAY int[].

  • 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-24T18:56:15+00:00Added an answer on May 24, 2026 at 6:56 pm

    I don’t think I understand your question well, but what about this:

    if(instr.getClass().isArray()) return instr instanceof NEWARRAY[];
    else return instr instanceof NEWARRAY;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm playing around with BCEL. I'm not using it to generate bytecode, but instead
How can I create Java Pojo at runtime? ASM or BCEL is required for
1.Could I add the comments to my existing java class with the BCEL? 2.Could
a colleague pointed me the other day to BCEL which , as best I
I'm trying to switch the class loader at runtime: public class Test { public
I'm considering the approaches to write class MyClass { @Get @Set protected int aValue;
How does eclipse internally build its internal representation of java code in order to
I am writing JVMTI code to profile Java programs, which mostly entails obtaining stack
The RFC for a Java class is set of all methods that can be
I have a list of jars in an ant task like this.. <path id=lib.path.id>

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.