Why Isn't My Code Insight Working?

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:24:22 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Why Isn't My Code Insight Working?

You're working on code all day. Every once in a while it seems that the class you've typed into your Java file isn't getting the context-senstive code insight like it should. What's the deal?

From my experience, these are the first things to check:

  1. Is the class you're trying to get insight on in your project's CLASSPATH environment?

    JDeveloper manages the classpath for your project through the Libraries panel in your project properties. Libraries are just easier-to-remember names like "BC4J Runtime" or "Oracle JDBC" that are nicknames for one or more directories and/or JAR files, separated by semicolons. Libraries also remember the paths to the source code and javadoc to complete the path to the class files need for the library. The order of the libraries in the Selected Libraries list controls the order of the classes at compile/runtime in the classpath. Your project's library list controls what classes the compiler and the Code Insight can "see". If code insight is not "popping" correctly, chances might be that you haven't included the library you need in your project's library list yet.
  2. Is the class you're trying to get insight on properly imported into the current class?

    Some code insight like method and argument insight depends on having the class you're wanting insight on properly imported. If you realize the class is not imported, you can use the JDeveloper feature for package/class insight and auto-imports to add it automatically. For example, if you have typed:

    URL u = new URL("http://www.oracle.com");
    u.

    and you're trying to get insight on the URL classes methods for the "u" member but it's not working, you can go back to the line above and in front of one of the occurrences of URL and type java.net. and then complete URL using the code insight for class names in the java.net package. Whenever class names are picked from code insight, we auto-adjust your imports to import all classes in the package (you can change that via a preference). That way, any subsequent classes in the package will have code insight work for them. Later, you can select "Organize Imports > Narrow Imports" from the right-mouse menu in the code editor to "clean up" the wide imports if you prefer narrow imports.
  3. You have some non-trivial syntax error somewhere in your Java class

    The behind the scenes parser that is keeping JDev abreast of the not-yet-compiled code changes you're making can get confused if there are non-trivial syntax errors in your code. Use the shortcut key [Ctrl]-[/] (control-forwardslash) to temporarily comment out the current line, then try compiling the file to locate the error.



© Copyright 2008 Steve Muench. Click here to send an email to the editor of this weblog.
Last update: 2/3/2008; 9:24:22 PM.