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.
There is a bug in source code of marking class methods. F.e. J2SE configuration XML file for defining categories contains mark for method FileReader's "reset()" method. This mark will not be created ( and as result will not me matched ) because "reset()" method is not FileReader's method. This method belongs to Reader class and inherited by FileReader. But algorithm for marks creation search methods which is defined only in class itself. Inherited methods are not included.
Set priority to P2 because there is consequence of this behavior : categorization works incorrectly for subtype marks. F.e. consider the following scenario : - Extend JPanel in your project. - Use it somewhere in your project UI code. - Profile this project. Choose only project classes option. As result there will be no classes in UI category. Classes will appear only if "All classes" option is chosen on profile dialog. This is incorrect because your custom class which extends JPanel is project class and it subclass of JComponent. Its method "repaint()" must present in UI category. The reason is the same as original issue description : "repaint()" method is inherited from JComponent. But algorithm doesn't see this method because it is not member of original class. As result mark for this method is not created and profiler runtime doesn't mark it also.
Can you, please, provide sample application and required steps to demonstrate this problem? Thanks.
Sorry , I have mistaken about UI category. JComponent configuration description contains only its own methods. The problem is still true actually f.e. for IO Category . There are Files subcategory which contains marks for FileReader subclasses. Steps to reproduce: 1) Create J2SE project with main class 2) Put into main method : FileReader reader = new FileReader( new File(some_file)); reader.read(); JDialog dialog = new JDialog(); dialog.setVisible(true); 3) Run profile on project with "Profile all classes" filer settings. Look at drill down and live results: there are no IO category. Live results contains method InputStreamReader.read() which is inherited by FileReader class. This method should be categorized as IO/Files.
The easiest way to understand problem is the source code. Just see the proposed patch : diff -r 16b5f6a4d34b profiler/src/org/netbeans/modules/profiler/categories/MarkerProcessor.java --- a/profiler/src/org/netbeans/modules/profiler/categories/MarkerProcessor.java Fri Apr 09 11:02:22 2010 +0400 +++ b/profiler/src/org/netbeans/modules/profiler/categories/MarkerProcessor.java Tue Jun 15 10:52:41 2010 +0400 @@ -272,7 +272,7 @@ Set<ElementHandle<TypeElement>> allImplementors = new HashSet<ElementHandle<TypeElement>>(); Set<ElementHandle<TypeElement>> implementors = controller.getClasspathInfo().getClassIndex().getElements(El ementHandle.create(superElement), kind, scope); - + do { Set<ElementHandle<TypeElement>> tmpImplementors = new HashSet<ElementHandle<TypeElement>>(); allImplementors.addAll(implementors); @@ -301,9 +301,9 @@ } try { controller.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED); - // process all methods from the implementor for (ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) { + //for (ExecutableElement method : ElementFilter.methodsIn( controller.getElements().getAllMembers(type))) { if ((method.getKind() == ElementKind.METHOD) && !method.getModifiers().contains(Modifier.ABSTRACT)) { if ((inclusive && restrictors.contains(method.getSimpleName().toString())) || (!inclusive && !restr ictors.contains(method.getSimpleName().toString()))) { try {
Created attachment 100077 [details] list all methods ( include inherited) instead of just enclosed
I'm sorry for the wrong comments in the patch. The string which is added should be uncommented. The previous one should be deleted or commented : //for (ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) { for (ExecutableElement method : ElementFilter.methodsIn( controller.getElements().getAllMembers(type))) {
changeset: 172914:fbf96a4d9a1e user: Denis Anisimov <ads@netbeans.org> date: Wed Jun 16 18:14:53 2010 +0400 summary: Unit tests for J2SE project categorization feature and fixes for BZ#187395 and BZ#187397
Integrated into 'main-golden', will be available in build *201006180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/fbf96a4d9a1e User: Denis Anisimov <ads@netbeans.org> Log: Unit tests for J2SE project categorization feature and fixes for BZ#187395 and BZ#187397
Seems to be fixed in 6.9.1