Using Javadoc with generics

hi, I have not yet found a way to use javadoc on my sources which contain some generics. The tool fails (with errors) and will eventually abort. Is there a doclet or a modified javadoc tool that will work?
error example:
AbstractModel.java:7: '{' expected
abstract public class AbstractModel<M> implements Model<M>

Now it works for me on Netscape, when oddly it didn't
yesterday. Hmmm... I didn't change a thing. Could it have been that you didn't have the "All Classes" frame open? This implementation is sensitive to that. No; you would still have gotten the "not found" dialog.
It seems to be case-sensitive, and require the full
name, which are unexpected, but understandable.Do you think it would be more effective if it were case-insensitive? It's a trivial fix, but since Java is decidedly case-sensitive, I went for that.
Yes, it also requires a correct class name, and not a substring. Not the fulIy-qualified name, though. (That's the whole point; usually I don't remember the fully-qualifed class name.) This can be altered, but you certainly don't want the first substring match to be the class opened.
A big limiting factor is that JavaScript is often really slow. You'll see that if you search for "Applet" it comes up fast because it's early in the list; searching for "ZoneView" takes forever. (You should have seen how slow in older versions of Mozilla.)
If you have to search through the whole list, such as for a "best" substring match, it will tend to always be slow.
I once had a substring search; it gives more trouble than it solves, and leads to more "unexpected" behavior than the current solution. If someone searches for "Link", what should the search show them? There are loads of classes that start with or contain "Link." Maybe just pop up a message box that shows the names of all the possible completions? (I'm not trying to over-engineer this; JavaScript could be made to open new windows, and generate new HTML documents, with select lists, but I'm not sure it's a desirable solution. And "unwanted pop-up blocking" (I love you, Mozilla!) would make none of it work. )
It's ironic that the search field seems to require
the presence of the All Classes list, and yet
somewhat
obsoletes its use (except when wanting to browse
through
names).Well, as you know, JavaScript "introspection" (if you will) requires that the document to be searched is loaded and parsed into a frame on-screen. No real way around that. (I think that using a hidden frame, or popping up a new window, is a horrible idea, so I'm not considering it.) Note that if you have the java.awt classlist open in the lower-left frame, searching for Button WILL work. This may actually be desirable behavior. Note that there are lots of name collisions in Java if you just consider the unqualified class name. If you're working with the AWT, and have the list of AWT classes open in that window, you probably want the AWT List to come up, not the Collection class List.
Maybe, if the class name is not found on the first pass, check the URL of the document loaded in the lower-left frame; then JavaScript can force that frame to reload the "All Classes" window if it's not the one loaded. I wouldn't do it automatically; that behavior may be annoying to users, or it may cause problems like the "List" example above. I'd ask them "Not found in (package x). Do you want to search in all packages?" using a JavaScript confirm() dialog first.
Another benefit and problem that's not obvious: the current solution works on JavaDocs that I've generated, too. You don't want to default to the Java distribution's "All Classes", and you may not even know where the canonical Java docs are to be found, so you can't do the trick listed in the previous paragraph.
Does JavaScript allow it to be modified to overcome
these limitations? Yes, mostly, but with tradeoffs, as discussed above.
Or could it be made to search
through
the index instead, so you could provide a method
before
choosing a class? If the index was on the screen, it could be searched. I'm not sure which class you'd pull up if there were multiple matches.
The current solution isn't meant to be a fix-all searching solution for everything; it's pretty obvious that there are limitations to what JavaScript can and should do. It all depends on what you want to support (including whether you care about browser independence.) This solution is a quick-n-dirty one designed to jump to a known class very quickly without scrolling all through those ever-growing lists, which is all I need 95% of the time. It sounds like you have bigger plans.
The idea of making a little Java Documentation Server that supplies documentation from a compressed file is a better long-term solution, in my opinion. It could do really powerful searches, and be browser-independent (i.e. not requiring JavaScript at all, which is something I don't like about the portability of my solution; I'd rather do everything from within Emacs,) and reduce the space used by Java documentation. I've written such a server in Perl, and I'm very pleased with the space savings, and the fact that it can uncompress and syntax-highlight source files on demand.
I'm hoping that this discussion might save you some time if you decide that this JavaScript-based approach is an approach you want to take for the distribution. Doing this in JavaScript as I've done works, for what I need most, but may not be ideal for the rest of the world.

Similar Messages

  • Using Javadoc with Command Prompt

    Hi is there anyway where I can use javadoc using command prompt?
    my friend said is
    "C:>javadoc *.java"
    but it did not work for me but can work for him...
    any help pls?
    THanks

    Search for the file javadoc.exe in your computer.
    If found, change to that directory* and issue a valid javadoc.command.
    If not found, download and install Java's JDK, which contains the file.
    * You can also set your os's path variable to include this directory.

  • How to use .class with generics

    Okay, in Java 5, Foo.class works just fine. But Map<Foo,Bar>.class does not. What is the right format?
    I am trying to get a field value through reflection:
    public static <T> T readFieldValueCastSave(
       Object target,
       String fieldName,
       Class<T> fieldType)
                   throws Exception{
              T r = null;
              Field f = getField(target.getClass(), fieldName);
              f.setAccessible(true);
              r = fieldType.cast(f.get(target));
              f.setAccessible(false);
              return r;
    }So this method works just fine for something like this:
    class Foo {
       private Bar myBarField;
    Bar b = readFieldValueCastSave(myFooObj, "myBarField", Bar.class);Now, what do I do in this case:
    class Foo {
       private List<Bar> myList;
    List<Bar> l = readFieldValueCastSave(myFooObj, "myList", List<Bar>.class);List<Bar>.class simply does not compile.
    Any suggestions ?

    That's because List<Bar>.class doesn't exist. List.class exists, use that.

  • Problem Using javadoc

    Hi,
    How to use javadoc with jsp.I am trying
    javadoc test.jsp and it is giving some error.
    thanks,
    suneet

    You can try to use Javadoc with the Java sources generated by jspc (the JSP compiler) but it is not very useful. (Even the generated classes change according to the web container. For instance, tomcat 4.0 generates classes in files named "filename$jsp.java" and iPlanet 6.5 generates classes in files named "filename.java" - in iPlanet you can't have a JSP named "default.jsp" because it will create problems with the reserved word "default".)
    Better to keep the Java code in Java source code files and try to use only tag libraries and very, very simple Java code in JSPs.

  • A question about a method with generic bounded type parameter

    Hello everybody,
    Sorry, if I ask a question which seems basic, but
    I'm new to generic types. My problem is about a method
    with a bounded type parameter. Consider the following
    situation:
    abstract class A{     }
    class B extends A{     }
    abstract class C
         public abstract <T extends A>  T  someMethod();
    public class Test extends C
         public <T extends A>  T  someMethod()
              return new B();
    }What I want to do inside the method someMethod in the class Test, is to
    return an instance of the class B.
    Normally, I'm supposed to be able to do that, because an instance of
    B is also an instance of A (because B extends A).
    However I cannot compile this program, and here is the error message:
    Test.java:16: incompatible types
    found   : B
    required: T
                    return new B();
                           ^
    1 errorany idea?
    many thanks,

    Hello again,
    First of all, thank you very much for all the answers. After I posted the comment, I worked on the program
    and I understood that in fact, as spoon_ says the only returned value can be null.
    I'm agree that I asked you a very strange (and a bit stupid) question. Actually, during recent months,
    I have been working with cryptography API Core in Java. I understood that there are classes and
    interfaces for defining keys and key factories specification, such as KeySpec (interface) and
    KeyFactorySpi (abstract class). I wanted to have some experience with these classes in order to
    understand them better. So I created a class implementing the interface KeySpec, following by a
    corresponding Key subclass (with some XOR algorithm that I defined myself) and everything was
    compiled (JDK 1.6) and worked perfectly. Except that, when I wanted to implement a factory spi
    for my classes, I saw for the first time this strange method header:
    protected abstract <T extends KeySpec> T engineGetKeySpec
    (Key key, Class<T> keySpec) throws InvalidKeySpecExceptionThat's why yesterday, I gave you a similar example with the classes A, B, ...
    in order to not to open a complicated security discussion but just to explain the ambiguous
    part for me, that is, the use of T generic parameter.
    The abstract class KeyFactorySpi was defined by Sun Microsystem, in order to give to security
    providers, the possibility to implement cryptography services and algorithms according to a given
    RFC (or whatever technical document). The methods in this class are invoked inside the
    KeyFactory class (If you have installed the JDK sources provided by Sun, You can
    verify this, by looking the source code of the KeyFactory class.) So here the T parameter is a
    key specification, that is, a class that implements the interface KeySpec and this class is often
    defined by the provider and not Sun.
    stefan.schulz wrote:
    >
    If you define the method to return some bound T that extends A, you cannot
    return a B, because T would be declared externally at invocation time.
    The definition of T as is does not make sense at all.>
    He is absolutely right about that, but the problem is, as I said, here we are
    talking about the implementation and not the invocation. The implementation is done
    by the provider whereas the invocation is done by Sun in the class KeyFactory.
    So there are completely separated.
    Therefore I wonder, how a provider can finally impelment this method??
    Besides, dannyyates wrote
    >
    Find whoever wrote the signature and shoot them. Then rewrite their code.
    Actually, before you shoot them, ask them what they were trying to achieve that
    is different from my first suggestion!
    >
    As I said, I didn't choose this method header and I'm completely agree
    with your suggestion, the following method header will do the job very well
    protected abstract KeySpec engineGetKeySpec (Key key, KeySpec key_spec)
    throws InvalidKeySpecException and personally I don't see any interest in using a generic bounded parameter T
    in this method header definition.
    Once agin, thanks a lot for the answers.

  • We're sorry. It seems there is a problem. Please try using Gmail with a supported browser. If you're encountering this error while using a supported browser, we

    after the last udpate I can no longer access gmail or youtube. the error message from gmail is: We're sorry. It seems there is a problem. Please try using Gmail with a supported browser. If you're encountering this error while using a supported browser, we suggest alerting your Internet Service Provider (ISP) that a proxy is failing to accept cookies on HTTP redirects.
    youtube just lists some generic issue regarding cookies, and my cookie settings are wide open. I can open both with safari so it is a firefox issue.

    Did you install any new add-ons lately? I see listed:
    AddThis 3.5.9 ({3e0e7d2a-070f-4a47-b019-91fe5385ba79})<br />
    Advertising Cookie Opt-out 1.5 ([email protected])<br />
    Flash Video Downloader 5.3.2 ([email protected])<br />
    Garmin Communicator 4.1.0 ({195A3098-0BD5-4e90-AE22-BA1C540AFD1E})<br />
    socialvest 0.5.5 ([email protected])<br />
    Troubleshooter 1.1a ([email protected])<br />
    eMusic Community Toolbar 3.21.0.1 ({9ee802e8-c931-47ab-b570-aa8f791598ca}) (Inactive)
    Are any of these new?

  • Error in Extraction with Generic Datasource via Function Module

    Dear Gurus,
    Iam working for BI-HR module.We are extracting data with generic data source via function module. The client some more extra fields in already existing DS. So we made a copy of that Function module and tried to create new generic DS, we got error while extraction like "Error occured during the extraction process". Can you please help in resolving this issue, your valuable suggestion would be highly appreciated.
    Thanks and regards
    Arun S

    Hi,
    Which structure are you using??
    Are you using the same old structure for this function module as well.
    Have you enhanced the structure with new required fields.
    New extrac fields needs to be added to existing structure if you are using the same or create a new one and make sure that you have all the fields in the structure which you are going to use in the data source.
    You need to take care for the append as well and the issue could be in the code as well.
    Make sure you have written the proper code and just for the new fields done an append
    Thanks
    Ajeet

  • Import from database an internal table with generic Type : Web Dynpro ABAP

    Hi everyone,
    i have a requirement in which i'm asked to transfer data flow between two frameworks, from WD Component to another. The problem is that i have to transfer internal tables with generic types. i used the import/ export from database approache but in that way i get an error message saying "Object references and data references not yet supported".
    Here is my code to extract a generic internal table from memory.
        DATA l_table_f4 TYPE TABLE OF REF TO data.
      FIELD-SYMBOLS: <l_table_f4> TYPE STANDARD TABLE.
      DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
      DATA: ls_indx TYPE indx.
      lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
      lo_componentcontroller->fire_vh_search_action_evt( ).
      ASSIGN l_table_f4 TO <l_table_f4>.
    *-- Import table for Help F4
      IMPORT l_table_f4 TO <l_table_f4> FROM DATABASE indx(v1) TO ls_indx ID 'table_help_f4_ID'.
    The error message is desplayed when last instruction is executed " IMPORT l_table_f4...".
    I saw another post facing the same problem but never solved "Generic Type for import Database".
    Please can anyone help ?
    Thanks & Kind regards.

    hi KIan,
    go:
    general type
    TYPE : BEGIN OF ty_itab,
               field1 TYPE ztab-field1,
               field2 TYPE ztab-field2,
    *your own fields here:
               field TYPE i,
               field(30) TYPE c,
               END OF ty_itab.
    work area
    DATA : gw_itab TYPE ty_itab.
    internal table
    DATA : gt_itab TYPE TABLE OF ty_itab.
    hope this helps
    ec

  • Program with generics compiles without -source 1.5 but doesn't run.

    This could probably be considered a bug in J2SE1.5 beta 1.
    A program with generics that is compiled with JDK 1.5 beta1 without the "-source 1.5" option behaves oddly: it compiles but sometimes fails to execute. It shouldn't behave like that. It should fail in the compilation, with a complaint about using the wrong version of the language.
    This odd behaviour doesn't always occur! In the small program below, I get that behaviour when using the EnumSet.range method.
    If I only use the basic EnumSet, it does executes.
    -- Lars
    import java.util.EnumSet;
    import java.util.*;
    public class Example {
         public enum Season { WINTER, SPRING, SUMMER, FALL }
         public static EnumSet<Season> warmSeason = EnumSet.range(Season.SPRING, Season.FALL);
         public static void main(String[] args) {
              System.out.println("Season: ");     
              for (Season s : Season.values()) {
              System.out.println(s);
              System.out.println("Cold Season: ");     
              for (Season s : warmSeason) {
              System.out.println(s);

    Example.java:6: warning: as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
        public enum Season { WINTER, SPRING, SUMMER, FALL }
               ^
    Example.java:6: ';' expected
        public enum Season { WINTER, SPRING, SUMMER, FALL }
                           ^
    Example.java:12: ';' expected
            for (Season s : Season.values()) {
                          ^
    Example.java:17: illegal start of expression
            for (Season s : warmSeason) {
            ^
    Example.java:20: ';' expected
        ^
    4 errors
    1 warning

  • How to use annotation with GUI in swing

    hi,
    i am new to annotation. I know how to use this with classes, methods and java elements. I am developing a tool in applet to post comment on my notepad, but unable to find that how to use this with GUI of swing. I have gone through most of forums and tutorials but got no idea. Anyone could give me little idea.
    Thanks

    >
    i need to use the applet mousedown function in swing..>There is no such class as 'applet' in the JRE, Swing has an upper case 1st letter, functions in Java are generally referred to as methods, and there is no 'mousedown' method in the JRE.
    OTOH a Swing JApplet inherits the mouseDown method from Component, and it was deprecated in Java 1.1. The documentation (JavaDocs) provides instructions on what to use instead.
    >
    is there any way to use it or any other alternative is available for this?
    if can provide me a sample code.>If can provide me cash. Short of that, you might actually need to do some research/coding of your own.
    As an aside. What does any of this have to do with Java 2D?

  • I have a router for my PC. Can I use this with a Macbook or do I have to buy added hardware?

    I have a router for my PC. Can I use this with a Macbook or do I need to buy hardware?

    Your answer confused me for a second (a generic router doesn't need an adaptor for Macs to use) and then it dawned on me you were referring to the enet adaptor the MBA requires

  • Can you use IMAP with the ipads mail feature?

    Can you use IMAP with the ipads mail feature?

    Kappy,
    Yes, our domain and email accounts are on a server that does accept IMAP. Also, our mac mini and imacs are all set up for IMAP. Buying an ipad will enable me to work from home during this winter.
    Another ?: do you know if you can use text edit with the iPads mail feature? Reason being we have about 100 generic emails that all we have to do is change a few fields before sending out. Can this be integrated in without having to recreate all these messages?
    -TIM

  • BUG: error rebuilding SQLJ files along other java files with generic

    I have done a rebuild on a package containing some SQLJ files, and (consistently) got the following error:
    C:\TeleMessage\trunk\src\telemessage\db\impl\dbAdmin.sqlj
        Error(44,18): Java Parsing. Encountered: <
        Expected: <IDENTIFIER> ...; "[" ...; The error at the cursor in the given file is not possible, since there was no '<' there, and besides - if I non-aggresively changed the file, e.g. narrowed imports, changed whitespace or added comments - the error remained in the same location.
    I went and done a search using regex in the package, for a line starting with 17 chars followed by a '<'.
    I found it in one of the normal JAVA files (not-SQLJ), at line 44 (surprise!) - in a Java 5 generics declaration, e.g. Map<String,Integer>. the 18th character was indeed the '<'.
    I'm guessing that the SQLJ translator (accidentally?) parses non-SQLJ files.
    If this cannot be fixed, it is really bad - it is one thing that JDeveloper cannot support Java 5 language features because of its dependancy in the SQLJ translator (which is not known to be upgraded until version 11g if at all), but the inability to compile SQLJ files in a project containing other non-SQLJ java files with Java 5 features is hard.
    I could only workaround this by rebuilding SQLJ files one at a time!
    I also have another type of error, when rebuilding the same project in a higher-level pacakge (root or "Application Sources"):
    C:\TeleMessage\trunk\src\dbtools\CallbackNumberFiller.sqlj
        Error(24,8): Missing semicolon.
        Error(24,8): Unbalanced curly braces.Again, the specified file could not be the one to blame - the location of the error is in the middle of the public modified keyword in a method declaration; nothing is neither missing nor unbalanced.
    This appears to be different, as it pops in the log near the end of the build process, when the JSPs are being built, specfically during the time the message log fills with "writing <...>" lines (after "translating <...>" and "compiling <...>".
    I can consistently reproduce both cases - please advise how I can help you find out what causes this.
    Regards,
    Yaniv Kunda

    First of all, this bug not JDeveloper's problem, but the SQLJ team's.
    You can read more posts about this:
    Re: BUG: Cannot translate SQLJ files with Java5 generics code
    Re: How to use SQLJ with Java 1.4 and 1.5?
    Re: SQLJ discontinued??
    And if we're at it, this is strange - I can't seem to find the oracle doc you quoted...
    SQLJ 11g? The latest release is a part of JPublisher 10.2 available from
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
    I also didn't find anything on google on 11g, nor about the part number you specified.
    Didn't find any Java 1.5 supporting SQLJ translators from other vendors as well.
    Do you have any link to this statement?
    But if we examine this bug again, the problem involves JDeveloper passing Java 5 featured JAVA files to the SQLJ translator.
    Isn't there a way to instruct the translator to use CLASS files compiled by a normal Java 5 compiler, instead of trying to compile the files itself?
    Regards,
    Yaniv Kunda

  • Doubts with generic service in "HCM processes and forms"

    Hello friends:
        Im having troubles trying to figure out how to use generic services. I implemented a badi with generic services and this have the following methods:
    IF_HRASR00GEN_SERVICE~GET_SPECIAL_FIELDS
    IF_HRASR00GEN_SERVICE~GET_FIELD_INFO
    IF_HRASR00GEN_SERVICE~GET_OPERATIONS
    IF_HRASR00GEN_SERVICE~INITIALIZE
    IF_HRASR00GEN_SERVICE~DO_OPERATIONS
    IF_HRASR00GEN_SERVICE~GET_HELP_VALUES
       I could initialize values of my form using only INITIALIZE method, and I could perform some validation using  and then DO_OPERATIONS.
       I cant understand what is the usage of methods like GET_FIELD_INFO and GET_OPERATIONS?? according to the badis help, get_field_info must be implemented, but i didnt do so and it worked anyway?
    I will be grateful with all your help,
    Best regards,

    GET_FIELD_INFO is for adding fields. Suppose you are using the generic service for IT0008 data. The IT0008 fields
    which need to be used on the adobe form has to be added in this method. You need to add field name and data element
    to the field_infos table. GET_OPERATIONS is used to define operations associated with the fields. Suppose you have a
    scenario when user selects personnel area all personnel subareas associated with the selected value should come.
    Then you need to group together personnel area and sub area together into an operation. Also even if a field is not aasociated
    with any operation, to add a field to form scenario you need group them into operations in GET_OPERATIONS.
    Check the class CL_IM_HRRCF_REQUI_REQUEST to determine how this can be used.
    Thanks,
    Aravind

  • Install problem JDeveloper 12c (12.1.2.0.0) (Build 6668) with Generic Installer on windows

    Hi,
    I am trying to install JDeveloper 12c (12.1.2.0.0) (Build 6668) with Generic Installer on windows .
    C:\Program Files\Java\jdk1.7.0_25\bin>java -jar C:\jdev_suite_121200.jar
    I get the following error :
    Extracting files................................................................
    Unsupported platform (unable to determine the startup directory location).
    The Oracle Universal Installer failed.  Exiting.
    When I try with windows install ( right click jdev_suite_121200_win32.exe and "run as administrator") , I get the following error:
    ERROR Launch:No such file or directory
    In the discussion (https://forums.oracle.com/thread/2573396?start=0&tstart=0) , it is said to be solved by "running as administrator" but it didn't work for me ...
    Thanks ...

    Hi,
      Can you please tell whether you are using 32-bit or 64-bit windows.
      If it is 64-bit then you must run as administrator. In Windows 7x64, just right click on the jDeveloper exe and choose "run as administrator..."
      Remove the existing Oracle folder and restart the system.
      Try to install in new drive.
      Oracle Fusion Middleware Installation Guide for Oracle JDeveloper - 11g Release 2 (11.1.2.4.0) Hope this link will give you more idea in installation.
    Thanks
    Pramila
    Message was edited by: d6866663-7e0d-4497-89df-99f670c41872

Maybe you are looking for