Getting an Object Identifier String given a line of source code? HELP!

(forgot to close the code tag on that last one!)
Hi there,
I am in desparate need of getting the object identifier given a particular line of source code. I need this for the debugger I'm writing, and since the jdb forum never gets reponses; just more unanswered questions.
Right so, here's my problem in more detail. I can find out when a method is called in the Java virtual machine, and what its name is, and arguments and values and such like - using the Java Debugging Interface. BUT: unfortunately I cannot get the object identifier used in the source code that generated this call. I can however get a unique long id that identifies this object .. if that helps?(thinking hashtables here maybe?!)
So, I may know that the constructor of EddClass has been called, and this the following line generated this call:
EddClass edd = new EddClass();.. so what I need is a fail safe way of finding out "edd" from this - given all types of method calls.
This is quite tricky because there are loads of ways methods can be called e.g.
tty.getClassExclusions(); // Here I would know getClassExclusions had been called, and I would need to find out the object identifier "tty" called it
Temp a, b, c;
a = b = c = new Temp(); // Here I would know the constructor for Temp had been called, but now I would just want to know "c"
AnotherEg ae = (new Egg()).getAnotherEg(); // and in this last case if I had found out that the Egg constructor had been called, I don't want to find out any object identifier from this line of code - since the object is anonymous; however if I had found out that getAnotherEg() had been called I would want "ae"Ok, well - please help: I'm making a Java Animator that will be freely available - that serves to graphically animate the execution of another java program. It'd be cool if one of you guys could help make it really cool. Plus there are Dukes available!!
- Edd.

this is quite a complicated question I think!
I'm not sure but you maybe need to know just about the whole java lang. spec to do this.
I'm sure there are plenty of free java parsers around, so unless you have a lot of time available its probably best to download one, figure some way to feed it a single line from within a code block, and extract its symbol table.
Once you have the symbol table, there will probably be some other data available from the parser to say which are identifiers.
Its then up to your debugger to figure out which one is the interesting one!
sorry this is so vague but I think you've asked for something that is quite involved!
asjf

Similar Messages

  • Is there anyway to get anchored objects to always be above line?

    When I copy an object (lets say an image) in InDesign with the Move Tool (V) selected and then paste into text it sometimes it's above line and sometimes it's inline. Text wrap doesn't seem to make any difference.
    When I copy an anchored object that is nicely above line and text is flowing around it and then paste it somewhere else in the text it changes to inline. How can I get these always to be above line instead of having to change them all?

    Change one of them to be Above Line (preferably the first time you anchor it)
    With the object anchored and in the position you want - go to Object Styles and create an object style for your anchored image and apply it.
    Now copy and paste the object to another location within the text.

  • Getting Color object from String

    hi
    i need to get a Color object from a string provided at runtime.ie for the string "RED" i need to get a object of Color.RED.I have already tried to use decode() from Color class but it throws numberformat exception,can someone guide me.

    Color.decode(String) will decode octal and hexidecimal representations of colors e.g.
    Color poo = Color.decode("0x215DB8"); // hex description of color
    works.
    If you want to use RED, BLUE ... read them at run into a String or whatever and then test this String to get what color the user wanted e.g.
    read from text file at run time that button colour should be ORANGE.
    In your code, put
    String colourStr; // read what colour the user specified into this var
    Color their_color = null;
    if(colour.equals("ORANGE"))
    their_color = new Color(Color.orange);
    else if(colour.equals("BLACK"))
    // you can guess what goes here.. and so on.
    It often nice to make them specify the hex value of the colour because there are more of these than the predefined colours (shock horror).
    Anyway,
    seeya, Edd.

  • Extra blank lines in source code

    I have built a website in Dreamweaver CS4 and have a client editing pages in Contribute CS5. Both of us are working on Windows 7, and the site is hosted on Linux. When she makes edits to the page, something is introducing a GAZILLION blank lines in the source code. A typical page for this site is about 380 lines of code. The problem page is now more than 310,000 lines code with 100-200 blank lines between every "real" line of code. What the...?!
    I need to know how to stop this and how to remove the blank lines from the source code using Dreamweaver.
    The page in question lives here: http://www.alexandercitychamber.com/member-category.html
    HELP!!!
    Jeff

    Hello, Diane -
    We've got two separate issues here, but I think we have the solution to both.
    1. How to stop Contribute from adding blank lines in the code, and
    2. How to clean up a GAZILLION lines of blank code in a document.
    First, Number 1. I assume you're working in Dreamweaver. If not, I'm not sure how to guide you. But, when you define a Contribute Site, there is an area to specify administrative roles and permissions. Under each Role, at the bottom, you will see a popup for what kind of server the site is hosted on. The default is Windows. I had to change this to Unix (Linux) to match the hosting of our problem site. Find out what platform your host is using. You will have to specify this under each admistrative Role. After doing this, I had the client make some edits, then I opened the files in Dreamweaver. No new blank lines. I admit, I still have my fingers crossed somewhat.
    Okay, now how to clean up your source code and remove blank lines. A developer friend found this on some forum I had not seen. I don't know where, but I am grateful to the person who wrote it. It didn't get all the blank lines in my files, but I think some of the others, which I removed manually, were probably from the client pasting content in from Word. Here's what to do:
    1. Open the file in Dreamweaver
    2. Click CTRL + F, or go to EDIT > FIND AND REPLACE
    3. Select "Current document" in "Find In" (You can also select the folder if you have multiple files.
    4. Search in "Source Code"
    5. Check the box labeled "Use regular expression"
    6. Type "[\r\n]{2,}" (without quotes) in "Find"
    7. Type "\n" (without quotes) in "Replace"
    8. Press "Replace All"
    The operation chugged for a few minutes with my 301,000-line document. Yours may a take a little longer, but it did work. Good luck!
    Jeff
    [email protected]

  • How to search for a string in ALL Function Modules source code

    Hello,
    I want to search for the string "HELLO" in all FUNCTION MODULES source code(FM, no reports/programs).
    Is this possible? How?
    Cheers,
    Andy

    hi,
    Execute RPR_ABAP_SOURCE_SCAN to search for a string in the code ... Press where-used-list button on the program which takes to the function group or the function module where it is used ..
    Regards,
    Santosh

  • Need script or Program to count lines of source code

    Hello, I need a script or a program that can count how many lines are there in a directory contains source code as well as other directories(contain code as well), there are .java files in these directories, the script or program should count number of lines with/without comments(starts with // or surrounded by /**/)
    Thanks a lot!!!

    I wrote a quick python program to count the lines in a file, you could just adapt it to your needs, or use the second program I have in this post that condenses all the .java files in a directory into a single text file, which you can then use a line-count on (useful if you need to print it as well - I wrote it for my IB dossier java project), if you'd like a proper script for your needs, otherwise check the other suggestions.
    Run it by copying the code into a text file and saying it as script.py (change script to whatever you want) and running it with python /path/to/script.py
    #!/usr/bin/env python
    #Program to tally the lines in a file
    #Author: lswest
    import os
    home=os.path.expanduser("~")
    endPath=raw_input("Path to file relative to your home directory (include file name and extension): ")
    count=0
    ff=open(os.path.join(home, endPath))
    for x in ff:
    count+=1
    values={'name': os.path.join(home,endPath), 'count' : count}
    print "The file %(name)s contains %(count)s lines." % values
    #!/usr/bin/env python
    #Script to condense the multiple files of a project into one for easy printing/copying
    #Author: lswest
    import os
    home=os.path.expanduser("~")
    endPath=raw_input("Path relative to your home directory to the project folder: ")
    extension=raw_input("Extension of files you want to condense: ")
    outPath=raw_input("Path to output file relative to home directory: ")
    outFile=raw_input("Output file name (including extension): ")
    ff=open(os.path.join(home+outPath,outFile), "wt")
    for root, dirs, files in os.walk(os.path.join(home,endPath), "true", "none", "true"):
    for infile in [f for f in files if f.endswith(extension)]:
    fh=open(os.path.abspath(os.path.join(root,infile)))
    for line in fh:
    ff.write(line,)
    fh.close()
    ff.close()
    Last edited by lswest (2009-03-10 16:23:52)

  • How to get Fennec full screen from the android project's source code?

    Hi,
    First and foremost, I'm sure this was not the proper category to post that question but I couldn't really figure out a better one. Hopefully you'll forward it to a better place.
    We would like to take the advantages of Fennec with out HTML5 framework by wrapping it into a somewhat WebView like you can do on Android. The native implementation of the webview on Android turns out to be very disappointing so far whereas Fennec runs seamlessly.
    Could you recommend us any tips to do that properly from the Fennec's Android app project?
    Basically we just want to be able to call sort of a new FennecWebView() class instance in our code (instead of the formerly new WebView() ) that will run full-screen and won't call any further things such as, bookmark manager, setting. We just want to scale this down to the very strict minimum in order to run our Canvas framework in a native app thanks to the Fennec's engine.
    Thank you very much!
    BR,
    Armand

    I've seen some interest in this from others. It was suggested that they build a web app manifest.
    https://developer.mozilla.org/en-US/docs/Apps/Getting_Started
    https://hacks.mozilla.org/2013/01/join-us-for-firefox-os-app-days/

  • How to count source code lines?

    Hi guys!
    I have a task to calculate total amount of lines of source code. The only way i have found out is to get report
    with read report prog into itab statement and get number of lines with describe itab lines num_of_lines.
    But in this way it is not possible to handle classes for example. Is it possible to count lines with SQL statement?

    Hi,
    try this report [https://wiki.sdn.sap.com/wiki/display/Snippets/SearchforStringsinABAPSourceCode].
    For counting the lines you specify a search string of
    The includes for classes can be specified by
    ZCL_XY*
    Best regards
    Thomas
    Edited by: Thomas Schulz on May 4, 2010 1:33 PM

  • To get Class object representing the primitive type by a String

    for classes,I can use
    classNameString = "java.lang.String"
    Class c=Class.forName(classNameString);
    to get Class object representing the classNameString.
    but to get Class object representing the primitive type ,I have to use something like :
    Class c=Integer.TYPE;
    is there any way to get Class object representing the primitive type by a String?

    not using Class.forName(). you'll just need to key off the String passed to see whether it names a primitive:class ClassUtilities {
       * Gives the <code>Class</code> corresponding to a named class or primitive.
       * @param  name  FQN of a class, or the name of a primitive type
       * @param  loader  a {@link java.lang.ClassLoader ClassLoader}
       * @return  the <code>Class</code> for the name given.  This method
       * converts primitive type names to their particular <code>Class</code>
       * object.  <code>null</code>, the empty string, <code>"null"</code>, and
       * <code>"void"</code> yield {@link java.lang.Void#TYPE Void.TYPE}.  If any
       * classes require loading because of this operation, the given
       * <code>ClassLoader</code> performs the loading.  Such classes are not
       * initialized, however.
       * @throws  ClassNotFoundException  if the name names an unknown class
       * or primitive
       * @see  java.lang.Class#getName
      static Class classForNameOrPrimitive( String name, ClassLoader loader )
        throws ClassNotFoundException {
        if ( name == null || name.equals( "" ) || name.equals( "null" ) || name.equals( "void" ) ) {
          return Void.TYPE;
        if ( name.equals( "boolean" ) )
          return Boolean.TYPE;
        if ( name.equals( "byte" ) )
          return Byte.TYPE;
        if ( name.equals( "char" ) )
          return Character.TYPE;
        if ( name.equals( "double" ) )
          return Double.TYPE;
        if ( name.equals( "float" ) )
          return Float.TYPE;
        if ( name.equals( "int" ) )
          return Integer.TYPE;
        if ( name.equals( "long" ) )
          return Long.TYPE;
        if ( name.equals( "short" ) )
          return Short.TYPE;
        return Class.forName( name, false, loader );
    }

  • Get class object for primitive datatype name stored in a string

    Hi,
    I have an array of Strings:
    String[] somePrimitives = {"int", "char", "void" };
    I want to achieve the equivalent of :
    for(int k = 0; k < somePrimitives.length; k++) {
    Class myClass = Class.forName(somePrimitives[k]); //Wont work
    We all know, we cannot do Class.forName("int") etc since "int" is not a path to
    an actual class - whereas Class.forName("java.lang.Integer") will work.
    Can anyone tell me how to achieve the above ?
    Of course, I don't want to have numerous hardcoded checking conditions like
    if(somePrimitives[k].equals("int")) return (Integer.TYPE);
    thanks.

    1. Why couldn't java provide me a simple provision to list all available primitives and their corresponding
    class mapping ? Why should I do the mapping...shouldn't the language have taken care of
    its provisions ?Yes, and native compilation on the fly, dynamic modification of classes, a sensible types system, usable Number tree, quasiquotation, access to the AST of the source, getting a method based on argument types rather than parameter types, etc. etc.
    2. Or even better they could have made the method
    Class.getPrimitiveClass(String primitiveDatatTypeName)
    as a public method. This would have solved the whole
    problem with a one line piece of code. Why did they
    have to make it non-public ???If you want it easy, go elsewhere.
    But seriously, the reflection capabilities were tagged onto Java as it grew, and were not designed to reflect the state of the art, but as a 'just enough to get by' solution. Most of the time people don't need it, so it's not there, any you have to roll your own.
    Pete

  • User defined function for getting last string in the line

    Hi Experts,
    I am not java expert, can anyone give me user defined function for getting last string in the line.
    for example if the source field is "NEW ARBOUR SQUARE"  i want to pass to target field only last string that is "SQUARE"
    please help me out of this.
    Kind Regards.
    Praveen.

    You don't even need a UDF for this. In the graphical editor look for the standard functions and once you do a scroll over on 'text functions; you will find what you are looking for.
    Just a piece of advice, try keeping UDF's to minimum unless really required or it is complicated without it.
    regards

  • How to get string (specified by line and column) from txt file with labview

    Hi everyone
    How to get string (specified by line and column) from txt file with labview
    thx 
    Solved!
    Go to Solution.

    As far as I know, a text file has no columns.  Please be more specific.  Do you mean something like the 5th word on line 4, where words are separated by a space, and lines are separated by a newline character?  You could the Read from Spreadsheet String function and set the delimiter to a space.  This will produce a 2D array of strings.  Then use index array and give the line number and column number.
    - tbob
    Inventor of the WORM Global

  • Line Chart: It is possible to get the object reference from a flash chart

    Hi Folks,
    hope you feel well ...
    I wan't to get the Object Reference from a Chart Flash Object using javascript in the HTML Header of a Apex Page.
    It's long time ago with Oracle/Java and so my skills are really shity :-)
    The Functionbody works, but the following error occurs: chart.refresh is not a function
    It is necessary to CAST it ? with the Class AnyChart.js ?
    After 5 hours i give up ^^ is this kind of object handling possible ? THX4HELP@ll
    Apex Page HTML Header
    <script type="text/javascript">
    function hideSID2()
    var chart = document.getElementById("*c7067437546726610*");
    chart.refresh();
    </script>
    HTML File at runtime:
    <div class="rc-body"><div class="rc-body-r"><div class="rc-content-main"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
    width="1400"
    height="600"
    id="c7067437546726610"
    align="top"> ...

    If you are using adobe Flex Builder to develop SWF, please be sure using ExternalInterface class to expose the refresh() method.
    then you can should be able to call this method in Javascript.

  • Issue with splitting string into multiple lines

    Hi Experts,
    I have a long string s. I want to split this string into several lines each having 72 characters. For this I have done following programming:
         String s = "For the first time it includes a supplementary report attempting to determine if extreme weather
    events can be linked to human-induced climate change. The research team, including members
    of the UK Met Office, identified recent episodes of extreme weather then used a computer to
    estimate the likelihood of the episode happening in a world without increased CO2." ;
         s = s.replaceAll("[\r\n]+", " ");
         char[] sAr = s.toCharArray();
         AbstractList RecepitsList7 = new Bapitrtext.Bapitrtext_List();;
         int start = 0; // start with
         int i = 72 ;
    //     for (int i = 71; i < sAr.length; i++) {
    while (i < sAr.length) {
    //     {     if (sAr[i] == ' ')
                   Bapitrtext Recepits7 = new Bapitrtext();
                   Recepits7.setTextid("TEXT");
                   Recepits7.setTextline(s.substring(start, i).replaceAll("[\r\n]+", ""));
                   RecepitsList7.add(Recepits7);
                   start = i+1;
                   i += 72;
         input.setText(RecepitsList7);
    The output of program is as below:
    For the first time it includes a supplementary report attempting to dete
    mine if extreme weather events can be linked to human-induced climate
    hange. The research team, including members of the UK Met Office, iden
    ified recent episodes of extreme weather then used a computer to estim
    te the likelihood of the episode happening in a world without increased
    Here as we can see last characters are getting deleted by program. For example in first line
    determine 'r' is missing in extreme right.
    In 3rd line c is missing in extreme left (word change is needed. Program
    prints hange.
    Also in 3rd line extreme right 't' is missing
    Also in 4th line extreme right 'a' is missing
    Also the last line is not being printed. In last line "CO2." " should appear.
    There are two issues:
    1. Why last word of each sentence is not being printed?
    2. Why last sentence is not being printed?
    I am struggling since last 2 days. Please help. I made all changes like replacing 72 by 71 etc.
    By making such changes, I am able to print first line correctly. However under all cases
    last character of 2nd line onward is not getting displayed.
    Also last line is not getting displayed. I did every thing like using while instead of for loop etc.
    Kindly help.
    Regards,
    Gary
    Edited by: 945655 on Jul 10, 2012 11:39 PM

    String s = wdContext.currentContextElement().getExpense_Text();
         s = s.replaceAll("[\r\n]+", " ");
         char[] sAr = s.toCharArray();
         AbstractList RecepitsList7 = new Bapitrtext.Bapitrtext_List();;
         int start = 0; // start with
         int i = 72;
    while (i < sAr.length) {
                   Bapitrtext Recepits7 = new Bapitrtext();
                   Recepits7.setTextid("TEXT");
                   System.out.println(s.substring(start, i));
                   RecepitsList7.add(Recepits7);
                   start = i+1;
                   i += 72;
         input.setText(RecepitsList7);
    Edited by: 945655 on Jul 11, 2012 2:25 AM

  • Functional module to get the File from a given Directory

    Hi all,
    I am using a FM name 'subst_get_file_list' to get the file from a given directory but it is accepting only 40 Character length file only my requirement is to accept file name other than 40 char,
    give me good sugestion
    regards
    paul

    Hi Paul,
    Check the Function Module Gayathri has given. ie. 'SO_SPLIT_FILE_AND_PATH'.
    In the exporting parameter FULL_NAME , give the path name and in the importing parameter stripped_name , you will get the filename.
    Check this code.
    REPORT ZSHAIL_SPLITFILE.
    data: it_tab type filetable with header line,
          gd_subrc type i.
    tables: rlgrap.
    data: path type string,
          file_name type string.
    parameters file_nam type rlgrap-filename .
    data: user_act type i.
    at selection-screen on value-request for file_nam.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        WINDOW_TITLE            = 'select a file'
       DEFAULT_EXTENSION       = '*.txt
        DEFAULT_FILENAME        = ''
        FILE_FILTER             = '*.txt'
        INITIAL_DIRECTORY       = ''
        MULTISELECTION          = abap_false
       WITH_ENCODING           =
      CHANGING
        file_table              = it_tab[]
        rc                      = gd_subrc
        USER_ACTION             = user_act
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if user_act = '0'.
    loop at it_tab.
    file_nam = it_tab-filename.
    endloop.
    endif.
    path = file_nam.
    CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
      EXPORTING
        full_name           = path
    IMPORTING
       STRIPPED_NAME       = file_name
      FILE_PATH           =
    EXCEPTIONS
      X_ERROR             = 1
      OTHERS              = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    at selection-screen.
    message i001(zmess) with file_name.
    Regards,
    SP.

Maybe you are looking for

  • Problem with CS6 and Quadro FX 4500

    I have 2 Quadro FX 4500 cards; 1 driving dual displays and the other driving a Cintiq 21 UX. Both cards have 512MB RAM operating under Win 7 with 16BG RAM. Premiere, AE and Phtoshop CS6 see them as incompatible in one way or another even with the lat

  • MDM ABAP API  ISSUE ( server  is getting down )

    Hi Folks, I am trying to retrieve matching results using MDM ABAP API. I am spiting source and target records into lot of blocks dynamically in program. I am getting output 2 to 3 times if i can run program sequential after that server is getting dow

  • Result Cache Oracle 11gR2

    Hi all, Currently I have some problems with result cache, or maybe I don't understand this feature properly. I'm trying to switch off the bypass mode, and I'm not able to do this: SQL> select dbms_result_cache.status from dual; STATUS BYPASS SQL> exe

  • Including additional where clause conditions to view criteria dynamically

    Hi, We have a set of view objects that serves as LOV for various other view objects. All such LOV view objects have three specific attributes, two date attributes namely EffectiveStartDate, EffectiveEndDate and a String attribute namely UserSwitch ba

  • Wlsifconfig.sh problems in Solaris 10

    Hi if in any time you are configuring Weblogic 11gR1 Whole Server Migration on a Solaris Machine, take care to change the wlsifconfig.sh file in <YOUR_DOMAIN_HOME>/bin/server_migration, in every machine that performs Whole Server Migration. Change th