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 173517 - AssertionError at org.netbeans.modules.javahints.StaticImport.hasMethodNameClash
Summary: AssertionError at org.netbeans.modules.javahints.StaticImport.hasMethodNameClash
Status: RESOLVED FIXED
Alias: None
Product: contrib
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: fommil
URL: http://statistics.netbeans.org/except...
Keywords:
: 175251 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-10-01 17:14 UTC by Jesse Glick
Modified: 2009-11-29 13:31 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 159389


Attachments
stacktrace (1.07 KB, text/plain)
2009-10-01 17:14 UTC, Jesse Glick
Details
stacktrace (1.07 KB, text/plain)
2009-10-30 14:00 UTC, jmichelberger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-10-01 17:14:47 UTC
This issue was originally marked as duplicate of issue 167554, that is already resolved. This issue is still valid, so this seems to be another issue, but it might be related.

Build: NetBeans IDE Dev (Build 090929)
VM: Java HotSpot(TM) Client VM, 14.1-b02, Java(TM) SE Runtime Environment, 1.6.0_15-b03
OS: Linux, 2.6.28-15-generic, i386

User Comments:
jglick: Using JNA, trying to get code completion on Native.loadLibrary.



Stacktrace: 
java.lang.AssertionError
        at org.netbeans.modules.javahints.StaticImport.hasMethodNameClash(StaticImport.java:322)
        at org.netbeans.modules.javahints.StaticImport.run(StaticImport.java:137)
        at org.netbeans.modules.java.hints.infrastructure.SuggestionsTask.run(SuggestionsTask.java:125)
        at org.netbeans.modules.java.hints.infrastructure.SuggestionsTask.run(SuggestionsTask.java:65)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:291)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:654)
Comment 1 Jesse Glick 2009-10-01 17:14:53 UTC
Created attachment 88691 [details]
stacktrace
Comment 2 Max Sauer 2009-10-05 10:51:10 UTC
Please have a look, thanks.
Comment 3 fommil 2009-10-06 22:22:36 UTC
spec number bumped, so submitter should get an update in their plugin list and see the fix.
Comment 4 Max Sauer 2009-10-23 09:17:43 UTC
*** Issue 175251 has been marked as a duplicate of this issue. ***
Comment 5 jmichelberger 2009-10-30 14:00:00 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-4163-on-091024)
VM: Java HotSpot(TM) Client VM, 14.2-b01, Java(TM) SE Runtime Environment, 1.6.0_16-b01
OS: Windows XP, 5.1, x86

User Comments: 


Stacktrace: 
java.lang.AssertionError
        at org.netbeans.modules.javahints.StaticImport.hasMethodNameClash(StaticImport.java:322)
        at org.netbeans.modules.javahints.StaticImport.run(StaticImport.java:137)
        at org.netbeans.modules.java.hints.infrastructure.SuggestionsTask.run(SuggestionsTask.java:125)
        at org.netbeans.modules.java.hints.infrastructure.SuggestionsTask.run(SuggestionsTask.java:65)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:291)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:654)
Comment 6 jmichelberger 2009-10-30 14:00:07 UTC
Created attachment 90297 [details]
stacktrace
Comment 7 fommil 2009-11-09 14:32:18 UTC
any chance you could upload the code snippet that caused this stacktrace? I see what is causing the assertion error, but I don't know why that code was called because the earlier call to getContainingClass should ensure that klass is, indeed, a CLASS.
Comment 8 Jesse Glick 2009-11-13 12:29:09 UTC
Sorry, it's been weeks and there is no chance I have the original code fragment lying around. If you need this information, include the relevant parts in the assertion message.

How is this FIXED? I don't see any changeset fixing it.
Comment 9 Jan Lahoda 2009-11-14 05:11:42 UTC
Any of class, enum, interface and annotation declaration map to Tree.Kind.CLASS. The corresponding element is ElementKind.CLASS/ENUM/INTERFACE/ANNOTATION, not only EK.CLASS, as hasMethodNameClash asserts. Code that causes this exception is e.g.:
public enum E {
    A;
    public void aa() {
        Math.max(0, 1);
    }
}

or:
public interface E {
    public void aa() {
        Math.max(0, 1);
    }
}
(not compilable, but code in the editor is very often not compilable.)

Also:
assert info.getTrees().getElement(<some-path>) != null
may be too strong, IMO - although declarations should ideally always have an attached element, I do not think it is guaranteed to have one in practice (sometimes the source code is too broken for the error recovery).