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 113953 - Freeform violates ClasspathProvider contract
Summary: Freeform violates ClasspathProvider contract
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Freeform (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords: API
: 46791 128711 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-28 09:35 UTC by Tomas Zezula
Modified: 2016-07-07 07:18 UTC (History)
5 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 Tomas Zezula 2007-08-28 09:35:13 UTC
The freeform project returns different ClassPath instances for single file & single type. It violates the ClassPath
contract, the ClassPath is a live object the clients listen on. When you return the other isntance the clients still
listen on the old instance.
Steps to reproduce:
1) Download freeform project: http://download.java.net/media/java3d/bugs/nb-bugs/113765.zip
2) Open j3d-core project
3) Open VirtualUniverse class, there is some error complaining about VersionInfo
4) oldBootCP = ClassPath.getClassPath (VirtualUniverse,BOOT)
5) Open project customizer, remove the build/default/debug/gen/classes/ from ClassPath and add it to SourcePath
6) Error: the ClassPath.getClassPath (VirtualUniverse,BOOT) != oldBootCP.
Comment 1 David Simonek 2007-08-30 11:24:59 UTC
Milan, reproducible for you?
Comment 2 Milan Kubec 2007-08-30 14:01:41 UTC
Yes, I'm working on it.
Comment 3 Milan Kubec 2007-08-31 14:06:33 UTC
Lowering priority to P3 as agreed upon with Tomas.
Comment 4 David Simonek 2007-08-31 14:22:24 UTC
:-)
Comment 5 Milan Kubec 2007-08-31 16:08:15 UTC
The problem is that if new source root is added/removed to/from CU new MutableClasspathImpl is created for the List of
CU source roots and the new CP is then returned for the same FO and then others listening on original CP are not notified.
Comment 6 Jesse Glick 2007-10-19 20:22:15 UTC
Not sure offhand how to fix. Perhaps it is possible to change

Map<String,Map<List<String>,MutableClassPathImplementation>> mutablePathImpls

to

Map<String,Map<String,MutableClassPathImplementation>> mutablePathImpls

and have several keys map to the same value? Then Classpaths.getPath would look for a match in keys of
mutablePathImplsByType among _any_ of packageRootNames, and store the path back in _all_ of them.

I think that would address the problem in this issue. This would however not work if you split apart a single CU into
two CUs, etc. Fundamentally I don't see how the "ClassPath contract" (which I do not see written anywhere) could
possibly be honored in all such cases.

What is the actual problem that gave rise to this bug report? If it is just that the old ClassPath instances do not
continue to fire changes when expected, that should be more easily addressed: currently the listener is Classpaths (see
pathsChanged method), but I think it could just as easily be MutableClassPathImplementation, which would ensure that
changes are fired regardless of whether a given ClassPath object is the currently "official" one. Such a fix would be
desirable in any case.
Comment 7 Tomas Zezula 2007-10-24 15:57:20 UTC
*** Issue 46791 has been marked as a duplicate of this issue. ***
Comment 8 Jesse Glick 2007-10-24 16:28:01 UTC
See last comment in issue #46791. If there were some definite contract for the behavior of ClassPath, it sounds to me
like that would be violating it, but I guess so long as java/source is happy with that behavior then use it.
Comment 9 Tomas Zezula 2007-10-24 17:12:48 UTC
We (java/source) don't have much problems with current state. It works in nearly all cases, the only problem was when
someone removed the source root from the compile classpath (don't know why it was there when the javac doesn't complete
sources on the compile classpath) and readd it into source path. In this case we know only about the old classpath not
about the new one which was created and we didn't know about next changes. After restart everything was OK.
Comment 10 Jan Lahoda 2008-02-28 22:27:37 UTC
*** Issue 128711 has been marked as a duplicate of this issue. ***
Comment 11 Lukas Hasik 2008-04-10 21:37:01 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 12 Antonin Nebuzelsky 2010-01-11 04:28:53 UTC
Changing the default component owner to tzezula.
Comment 13 David Strupl 2012-10-25 13:41:47 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 14 Tomas Zezula 2012-10-26 06:40:33 UTC
Definitely not P4 as it is a source of several scanning problems.
Comment 15 Tomas Mysik 2012-10-26 13:52:25 UTC
(In reply to comment #13)
> Bug prior to 7.0, not touched for the last 2 years --> P4.

Sorry, I do not think that this could be a valid reason for P4.
Comment 16 Martin Balin 2016-07-07 07:18:18 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss