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 71959 - Code Completion not working for sources outside project.
Summary: Code Completion not working for sources outside project.
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Jan Lahoda
URL:
Keywords: RELNOTE
Depends on:
Blocks:
 
Reported: 2006-01-28 09:56 UTC by _ alexlamsl
Modified: 2007-06-25 13:50 UTC (History)
2 users (show)

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 _ alexlamsl 2006-01-28 09:56:40 UTC
(Using NetBeans 5.0 RC2 on both sides with latest Collab module from Beta UC, 
but using different builds of Mustang)

Code Completion on the remote side does not work with shared files, as if all 
the core Java classes do not exist.

Test case:

---------------------------------
Engine.java
---------------------------------

package codecanalyst;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Engine {
    
    private static final ExecutorService pool = 
Executors.newSingleThreadExecutor();
    
    private Engine() {
    }
    
    public static EngineTask run(Configuration config) {
        return null;
    }
    
}

---------------------------------
Configuration.java
---------------------------------

package codecanalyst;

public class Configuration {
}

---------------------------------

Steps to reproduce:

1) Ctrl+\ on the dot behind Executors shows "class" as the only option.

2) Removing the import statements then try Fix Imports:
 - sometimes import a funny Configuration from somewhere within the Java core 
package (when it imports Executors & ExecutorService correctly)
 - or else it'll just say all the classes are not found and failed to import 
any of them
Comment 1 _ alexlamsl 2006-01-28 11:03:46 UTC
don't know if this matters but my javac outputs English (well, whose don't?) 
and my friend's in Chinese (?!)
Comment 2 Petr Nejedly 2006-02-06 16:08:29 UTC
That's generic problem of nonproject java sources.
If you open an ad-hoc java source, code completion should ude default platform
for completion, but it seems it fails to in 5.0 release (it used to work in
50dev builds).

Reassigning.
Comment 3 Tomas Zezula 2006-02-10 17:09:24 UTC
The
org.netbeans.modules.java.j2seplatform.platformdefinition.DefaultClassPathProvider
returns valid non empty classpaths for ClassPath.SOURCE, ClassPath.BOOT and
valid empty classpath for ClassPath.COMPILE, but the code completion shows nothing.
Comment 4 Jan Becicka 2006-03-17 18:46:04 UTC
Editor guys, do you set correct classpath for transaction?
Comment 5 Miloslav Metelka 2006-03-21 15:08:06 UTC
The JMIUtils.beginTrans() only contains
  JavaModel.setClassPath(fileObject);
Not sure what else should be there regarding classpath. Reassigning back to java
- please possibly update the editor's code if necessary regarding this. Thanks.
Comment 6 hanasaki 2007-01-09 03:08:35 UTC
I think this is the same as what I am seeing in:
NetBeans IDE Dev (Build 200701041900)
1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
Linux version 2.6.19.1 running on i386
en_US (nb); UTF-8

project1 uses project2.  smart completion of classes used from project2, in
project1, doesn't work.  Also, the error checking (right side of the editor
window) and the red/green box showing erors or not, shows errors for classes
from project1, used the right way.  Builds/Runs fine.
Comment 7 Jan Becicka 2007-06-08 12:32:30 UTC
Fixed?
Comment 8 Jan Lahoda 2007-06-25 13:50:29 UTC
Code completion on a file outside the project works for me in a current build (without project metadata the result is
not optimal, though). hanasaki, your problem seems to be different, could you please file a new issue with detailed
steps to reproduce? Thanks.