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.
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.
Regression relative to the trunk.
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?
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.
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?
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.
*** Issue 43161 has been marked as a duplicate of this issue. ***
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.
Created attachment 14955 [details] Log excerpt
Also opening NbEditorKit.java and jumping to a method via the toolbar, I got a few other errors on console.
Created attachment 14962 [details] More exceptions
I cannot reproduce it in latest builds. I can open projectless *.java file. Editor's combo is empty -> thus no exeptions thrown.
verified