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 50688 - [tests] Find usages sometimes doesn't work right after Refactor | Rename
Summary: [tests] Find usages sometimes doesn't work right after Refactor | Rename
Status: CLOSED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 4.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords: RANDOM, T9Y
: 50214 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-21 11:14 UTC by ehucka
Modified: 2007-04-03 18:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NPE's stacktrace (4.49 KB, text/plain)
2004-10-21 11:15 UTC, ehucka
Details
Stacktraces (188.05 KB, text/plain)
2004-10-26 12:54 UTC, Jan Becicka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ehucka 2004-10-21 11:14:39 UTC
refactoring/qa-functional/jdk15 automated tests

There are failing Find usages tests:
findClassAllSubtypes test doesn't find a subtype
with declared generic (finding class A):

public class B<T> extends A<T>

findField - doesn't find a field occurance with
generic

list = new ArrayList<String>();

There are also thrown some NPE into the ide.log.
Comment 1 ehucka 2004-10-21 11:15:19 UTC
Created attachment 18427 [details]
NPE's stacktrace
Comment 2 Martin Matula 2004-10-21 11:18:02 UTC

*** This issue has been marked as a duplicate of 50666 ***
Comment 3 _ tball 2004-10-21 18:32:24 UTC
Where are the refactoring/qa-functional/jdk15 automated tests, and how
do I run them?  I found a refactoring/test/qa-functional directory,
but it doesn't have a jdk15 subdirectory.  Running ant in
refactoring/test only ran the unit tests.  Thanks!
Comment 4 ehucka 2004-10-22 08:57:51 UTC
jdk15 is a testattribute of qa-functional test. Try to run build.xml
in refactoring/test fodler with set properties:
xtest.testtype=qa-functional
xtest.attribs=jdk15

Comment 5 ehucka 2004-10-25 10:29:02 UTC
The tests are still failing. They don't find some occurances of some
classes.
Comment 6 Jan Becicka 2004-10-25 14:46:05 UTC
I cannot reproduce it manually. I assume, that Find Usages does not
work, because some refactoring in previous tests did not finish correctly.
Comment 7 Jan Becicka 2004-10-25 18:07:03 UTC
This bug is RANDOM, not reproducible manually (at least I cannot
reproduce it) and unfortunately I cannot reproduce it while the tests
are running under the debugger.

Problem in findField test is, that some occurences of "list" are
sometimes resolved to UnresolvedClass.

BTW refactoring operations made by these tests are not enclosed by MDR
transaction.
Comment 8 ehucka 2004-10-26 08:46:32 UTC
Should be Find usages enclosed by mdr transactions? I assumed that it
shouldn't. Am I wrong? (All find usages tests are not done in
transactions.)
Comment 9 Jan Becicka 2004-10-26 09:29:04 UTC
> Should be Find usages enclosed by mdr transactions? I assumed that it
shouldn't. Am I wrong?

Yes it should.

> (All find usages tests are not done in transactions.)
Some are done, some not, why?
e.g.
WhereUsedTestCase.findFiled() is enclused by transaction, but
findClass() doesn't. Why?

Anyway - this is not the problem in this case. This bug happens
sometimes even if I added those transactions.

Comment 10 ehucka 2004-10-26 10:02:49 UTC
I've repaired the tests.
Comment 11 Jan Becicka 2004-10-26 12:47:37 UTC
I found out, that parser is sometimes unable to resolve several classes.
I'm attaching series of dumpStacks showing that parser failed to
resolve classes. 
Comment 12 Jan Becicka 2004-10-26 12:54:53 UTC
Created attachment 18516 [details]
Stacktraces
Comment 13 Jan Becicka 2004-10-27 13:44:37 UTC
*** Issue 50214 has been marked as a duplicate of this issue. ***
Comment 14 Jan Becicka 2004-10-27 16:20:20 UTC
We did some improvements, but this bug is still reproducible:

User: jbecicka
  Date: 04/10/27 00:34:13

  Modified:    javacore/src/org/netbeans/modules/javacore
                        RepositoryUpdater.java ExclusiveMutex.java
  Log:
  + Resources are deleted during start of outer transaction
  + parseIfNeeded is called during start of outer transaction (not
every transaction) this should supress some InvalidObjectExceptions

User: mmatula 
  Date: 04/10/27 06:23:47

  Modified:   
javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel
                        ResourceImpl.java
  Log:
  Another up-to-date checking bug fixed.

Comment 15 Jan Becicka 2004-10-29 09:29:17 UTC
I cannot reproduce this bug, If I remove other tests from this test
bag. It looks like the problem is not with JDK 1.5.
Comment 16 Jan Becicka 2004-10-29 12:28:41 UTC
Finally I found reproducible "manual" test case!!!
1. Open refactoring/test/qa-functional/data/projects/default2
2. Do Find Usages on abc.A (10 occurences found)
3. Do Rename on abc.A -> RenamedA
4. Do Find Usages on abc.RenamedA (only 3 occurences found)

Exceptions thrown to console.
Comment 17 Jan Becicka 2004-10-29 18:53:15 UTC
Problem is, that some MultipartIds has isNew==true even after
successful commit.
Comment 18 Jan Becicka 2004-11-03 10:01:42 UTC
We have a fix for my test case, but unfortunately not for original
report. Emane, please where is test spec. describing what these tests
does?
Comment 19 Jan Becicka 2004-11-03 12:18:47 UTC
2 bugs fixed here:
1. change of multipartid was not propagated correctly to it's parent
2. NameRef in SemiPersistentElement was constructed from simple name
instead of full name

Fixes applied to trunk. It is hard for us to verify random bug. Please
check latest test results and let us now, if this bug is still there.
Thanks

Checking in FieldImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/FieldImpl.java,v
 <--  FieldImpl.java
new revision: 1.18; previous revision: 1.17
done
Checking in JavaClassImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/JavaClassImpl.java,v
 <--  JavaClassImpl.java
new revision: 1.38; previous revision: 1.37
done
Checking in MethodImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/MethodImpl.java,v
 <--  MethodImpl.java
new revision: 1.16; previous revision: 1.15
done
Checking in ParameterImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ParameterImpl.java,v
 <--  ParameterImpl.java
new revision: 1.10; previous revision: 1.9
done
Checking in SemiPersistentElement.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/SemiPersistentElement.java,v
 <--  SemiPersistentElement.java
new revision: 1.57; previous revision: 1.56
done
Comment 20 Jan Becicka 2004-11-03 14:57:00 UTC
Emane, please can you provide detail description of what these tests
exactly does? Thanks
Comment 21 Jan Becicka 2004-11-04 09:45:29 UTC
Pavel will try to find it...
Comment 22 ehucka 2004-11-04 11:27:12 UTC
Failing tests are Find usages and Rename. But there are Move class
tests and Encapsulate fields tests running before. Each test has its
test case written at the begin of its .ref file. After a test is
finished undo action is called (except find usages tests). Test
sources are in the CVS. Do you want some more detail informations?
Comment 23 Pavel Flaska 2004-11-08 14:28:42 UTC
Fixed in trunk.

Checking in
java/javacore/src/org/netbeans/modules/javacore/internalapi/UndoManager.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/internalapi/UndoManager.java,v
 <--  UndoManager.java
new revision: 1.10; previous revision: 1.9
done
Processing log script arguments...
More commits to come...
Checking in
java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/SemiPersistentElement.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/SemiPersistentElement.java,v
 <--  SemiPersistentElement.java
new revision: 1.59; previous revision: 1.58
done
Processing log script arguments...
More commits to come...
Checking in refactoring/test/cfg-unit.xml;
/cvs/refactoring/test/cfg-unit.xml,v  <--  cfg-unit.xml
new revision: 1.4; previous revision: 1.3
done
Comment 24 Martin Matula 2004-11-09 16:33:53 UTC
I reviewed the fix - it is OK.
Comment 25 Pavel Flaska 2004-11-10 13:48:58 UTC
Fix merged to release40 branch.

Checking in
javacore/src/org/netbeans/modules/javacore/internalapi/UndoManager.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/internalapi/UndoManager.java,v
 <--  UndoManager.java
new revision: 1.9.8.1; previous revision: 1.9
done
Processing log script arguments...
More commits to come...
Checking in
javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/FieldImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/FieldImpl.java,v
 <--  FieldImpl.java
new revision: 1.16.8.2; previous revision: 1.16.8.1
done
Checking in
javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/JavaClassImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/JavaClassImpl.java,v
 <--  JavaClassImpl.java
new revision: 1.37.2.3; previous revision: 1.37.2.2
done
Checking in
javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/MethodImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/MethodImpl.java,v
 <--  MethodImpl.java
new revision: 1.14.8.2; previous revision: 1.14.8.1
done
Checking in
javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ParameterImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ParameterImpl.java,v
 <--  ParameterImpl.java
new revision: 1.8.8.2; previous revision: 1.8.8.1
done
Checking in
javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/SemiPersistentElement.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/SemiPersistentElement.java,v
 <--  SemiPersistentElement.java
new revision: 1.55.2.3; previous revision: 1.55.2.2
done
Processing log script arguments...
Comment 26 ehucka 2005-03-15 12:20:25 UTC
verified