This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 11068 - getFullname() on an Identifier for an interface that is in a mounted jar returns unqualified name
Summary: getFullname() on an Identifier for an interface that is in a mounted jar retu...
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: PC Windows 3.1/NT
: P1 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-04-05 01:29 UTC by Andrew Sherman
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Sherman 2001-04-05 01:29:46 UTC
Mount j2ee.jar into IDE

  You can find j2ee.jar in a FJEE kit in $NETBEANS_HOME/lib/ext
  I (andrew.sherman@ebay.sun.com) can mail anyone a copy of they need it.
  
Add an interface called 'MySession;':


  import java.rmi.RemoteException;

  import javax.ejb.EJBObject;

  public interface MySession extends EJBObject {
  }

Add a class ad set to internal execution:

  /*
   * runner.java
   *
   * Created on April 4, 2001, 3:06 PM
   */
  import org.openide.src.*;
  /**
   *
   * @author  asherma
   * @version 
   */
  public class runner {

      /** Creates new runner */
      public runner() {
      }
      
      public void run() {
          System.out.println("hello world");
          s = ClassElement.forName("MySession");
          printInterfaces(s);
         
      }
      static void printInterfaces(ClassElement c) {
          System.out.println("Class=" + c.getName().getFullName());
          Identifier[] ia = c.getInterfaces();
          for (int i = 0 ; i < ia.length ; i++) {
              Identifier iden = ia[i];
              String s = iden.getFullName();
              System.out.println("interface full name=" + s);
          }
      }
          
      /**
      * @param args the command line arguments
      */
      public static void main (String args[]) {
          runner r = new runner();
          r.run();
      }

  }

Run the class. You will see:

  Class=MySession 
  full name=EJBObject

You should see the fully qualified name of EJBObject, 
which is 'javax.ejb.EJBObject'.
Comment 1 Jan Becicka 2001-04-05 09:38:02 UTC
I think this is not P1 issue. There is no data loss/corruption. This bug does 
not block work with IDE.
Comment 2 Svata Dedic 2001-04-05 10:19:13 UTC
            I found the most probable cause, comment if it can be true:

The parser keeps a cache of symbols internally. It is possible that, if the 
parser received a request to compute something in the package javax.ejb before 
the j2ee.jar was mounted, it didn't found any classes in that package (since 
they weren't mounted yet) and cached empty package.

After you (or the module) mounted the j2ee.jar, it just ignored the javax.ejb 
package in it, since it has that package (but with wrong contents) in the 
cache.

Note that the source text is not reparsed until it is really changed somehow. 
The data *may* be inconsistent when some libraries appear or disappear from 
the filesystems, but it is a design decision and a tradeoff between parser's 
accuracy and CPU horsepower requirements. The cache is completely flushed 
every 30 requests or so anyway.

I will adjust the parser implementation so it watches out for Repository 
changes and flushes its caches immediately when something appears or 
disappears there.

Comment 3 Andrew Sherman 2001-04-05 15:19:27 UTC
First I am changing the priority back to P1.
This bug is breaking FJEE (EJBModule cannot write a jar file).
If there were a workaround then I would agree to a lower priority.

I think that there is something in what Svata suggests. yesterday I put a stack 
trace in Identifier's constructor  which printed when an Identifier for 
EJBObject was made. The Identifier is definitly being made 2 or sometimes 3 
times. But the bug occurs even if you are not using automount. 
Comment 4 Andrew Sherman 2001-04-05 15:22:13 UTC
It is not clear whether you were able to reproduce the bug or not. Please let 
me know if you need any help with this. 
Comment 5 Svata Dedic 2001-04-05 15:29:51 UTC
I was able to reproduce it. Given that the parser works OK when the IDE is 
initialized, only some special conditions would cause it to produce incorrect 
result. I've run your sample and it reported the identifier "EJBObject" as 
unresolvable. So, I assumed that since the file is parsed during explorer 
window open and _before_ another thread alerted by project support mounts your 
JAR into the project, I have decided to mount the jar globally, before any 
project is opened.
The same behaviour would occur if you open the file first (or have it parsed 
in some manner), then mount the jar. 
The parser would eventually catch up even without this fix - it serves only a 
several dozens of requests, then resets itself. Now it resets itself whenever 
repository contents change (mount, unmount, reorder) just to operate on 
current data.

Supposedly fixed in dev & release 3.2


Comment 6 Jan Chalupa 2001-05-05 23:23:49 UTC
Target milestone -> 3.2
Comment 7 Jan Becicka 2001-06-18 13:17:03 UTC
[010616] Verified
Comment 8 Quality Engineering 2003-07-01 13:14:45 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.