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 43041 - [projects] Projectless *.java appear as text files
Summary: [projects] Projectless *.java appear as text files
Status: CLOSED WORKSFORME
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 4.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: issues@java
URL:
Keywords: REGRESSION
: 43161 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-10 20:11 UTC by Jesse Glick
Modified: 2007-04-03 18:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Log excerpt (16.93 KB, text/plain)
2004-05-18 21:39 UTC, Jesse Glick
Details
More exceptions (8.48 KB, text/plain)
2004-05-19 01:13 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2004-05-10 20:11:07 UTC
Refact. May 10, JDK 1.5.0 b50.

I opened a sample Java file w/ no class path
(actually inside a project but not in a source
root). Its Explorer icon is that of a text file
and it opens as text/plain!

Surely Java syntax coloring is not too much to ask.
Comment 1 Jesse Glick 2004-05-10 20:11:23 UTC
Regression relative to the trunk.
Comment 2 Martin Matula 2004-05-10 21:45:51 UTC
This is weird. I've just tried it and it works perfectly. I am opening
files that are in no open project, then I open files from JDK (AFAIK
these are not on the source path). Everything works including syntax
coloring, code completion, etc. Could you please provide more info on
how to reproduce this?
Comment 3 Jesse Glick 2004-05-11 00:55:58 UTC
Files which have a defined CP that happen to be in a closed project
probably work - I didn't try that. I also did not try files from the
JDK - these also get a defined CP from the platform impl. I am talking
about files with no defined CP. I think what I tried was
${nb_all}/ant/freeform/eg/simple/src/org/foo/app/MyApp.java which
should have no CP yet (it will when freeform projects are in the build).

Note: due to a bug in apisupport/project it might have CP.BOOT and
nothing else. Not sure if this matters.

Do you have code to only conditionally recognize *.java as
JavaDataObject? It really looked like the file was not treated as a
JDO at all.
Comment 4 Martin Matula 2004-05-11 08:57:34 UTC
Oh, OK, I see. The problem is that the file is not on the classpath
returned by calling getClassPath on it. For this case we can fake its
source path, but it seems to me that it would be more appropriate if
this classpath (that contains at least the file itself) could be
provided directly by the project system. What do you think?
Comment 5 Jesse Glick 2004-05-11 11:54:37 UTC
Jo, there is an open RFE to produce a fallback CP.SOURCE for random
*.java files - if they have a usable package statement. So that would
help. Would still happen for "stray" Java files not in a reasonable
package structure, but that is probably much less common. Ideally they
would all be recognized as Java sources but any features that required
knowledge of their classpath or such behavior would just be disabled
when appropriate.
Comment 6 Jan Becicka 2004-05-12 16:20:05 UTC
*** Issue 43161 has been marked as a duplicate of this issue. ***
Comment 7 Jesse Glick 2004-05-18 21:37:50 UTC
The May 18th build is worse; some Java files appear with the correct
icon etc. but cannot be opened at all.

Tested on

.../nb_all/ant/src-bridge/org/apache/tools/ant/module/bridge/impl/NbBuildLogger.java

(no CP defined).

Editor window appeared but was just gray. Attaching exceptions found
in dialog.
Comment 8 Jesse Glick 2004-05-18 21:39:04 UTC
Created attachment 14955 [details]
Log excerpt
Comment 9 Jesse Glick 2004-05-19 01:12:15 UTC
Also opening NbEditorKit.java and jumping to a method via the toolbar,
I got a few other errors on console.
Comment 10 Jesse Glick 2004-05-19 01:13:21 UTC
Created attachment 14962 [details]
More exceptions
Comment 11 Jan Becicka 2004-05-28 13:41:01 UTC
I cannot reproduce it in latest builds. I can open projectless *.java
file. Editor's combo is empty -> thus no exeptions thrown.

Comment 12 Jiri Prox 2005-07-18 13:13:13 UTC
verified