TestFramework : strange stacktrace, while testing sample InspectionPlugin


Using IDEA TestFramework, I'm wrapping a few tests around Maxim S's
ComparingReferencesInspectionPlugin. The plugin (http://www.intellij.org/twiki/bin/view/Main/InspectionPlugins)
still works fine with 926, but when called from a very basic
LightCodeInsightTestCase, it crashes on :


with a stacktrace, that strangely mentions "javax/servlet/jsp/tagext/TagExtraInfo".
(There is no jsp in the project).

I wonder if I'm using the stuff in the wrong way, or if it's an IDEA bug. It crashes as well in debug as in run mode.
I'm stuck.


Alain

Note : has anybody written test for inspections/intentions yet? Please share.








The offending plugin line is line 96 :

    PsiType lType = lOperand.getType();  <== problems here

]]>






The test code that crashes the plugin :



(a.java:33) at com.intellij.psi.impl.source.bj.j(bj.java:202) at com.intellij.psi.scope.h.a(h.java:111) at com.intellij.psi.scope.h.a(h.java:122) at com.intellij.psi.scope.h.a(h.java:136) at com.intellij.psi.scope.h.a(h.java:159) at com.intellij.psi.impl.source.c.a.bh.b(bh.java:3) at com.intellij.psi.impl.source.c.a.bh.a(bh.java:78) at com.intellij.psi.impl.source.c.a.a.b(a.java:1) at com.intellij.psi.impl.source.c.a.a.a(a.java:16) at com.intellij.psi.impl.source.a.c.a(c.java:32) at com.intellij.psi.impl.source.c.a.bh.multiResolve(bh.java:25) at com.intellij.psi.impl.source.c.a.bh.advancedResolve(bh.java:90) at com.intellij.psi.impl.source.c.a.bh.getType(bh.java:13) at com.intellij.codeInspection.ComparingReferencesInspection$1.visitBinaryExpression(ComparingReferencesInspection.java:96) at com.intellij.psi.impl.source.c.a.h.accept(h.java:42) at com.intellij.psi.impl.source.c.u.acceptChildren(u.java:47) at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java) at com.intellij.psi.JavaElementVisitor.visitVariable(JavaElementVisitor.java:126) at com.intellij.psi.JavaElementVisitor.visitLocalVariable(JavaElementVisitor.java:107) at com.intellij.psi.impl.source.c.a.ba.accept(ba.java:64) at com.intellij.psi.impl.source.c.u.acceptChildren(u.java:47) at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java) at com.intellij.psi.JavaElementVisitor.visitStatement(JavaElementVisitor.java:176) at com.intellij.psi.JavaElementVisitor.visitDeclarationStatement(JavaElementVisitor.java:51) at com.intellij.psi.impl.source.c.a.n.accept(n.java:15) at com.intellij.psi.impl.source.c.u.acceptChildren(u.java:47) at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java) at com.intellij.psi.JavaElementVisitor.visitCodeBlock(JavaElementVisitor.java:76) at com.intellij.psi.impl.source.c.a.bt.accept(bt.java:13) at com.intellij.codeInspection.ComparingReferencesInspection.analyzeCode(ComparingReferencesInspection.java:80) at com.intellij.codeInspection.ComparingReferencesInspection.checkMethod(ComparingReferencesInspection.java:56) at testcase.BugSpike.test1(BugSpike.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.testFramework.LightCodeInsightTestCase.a(LightCodeInsightTestCase.java:131) at com.intellij.testFramework.LightCodeInsightTestCase$2.run(LightCodeInsightTestCase.java:4) at com.intellij.openapi.command.b.b.executeCommand(b.java:0) at com.intellij.testFramework.LightCodeInsightTestCase$1.run(LightCodeInsightTestCase.java:2) at com.intellij.openapi.application.a.d.runWriteAction(d.java:177) at com.intellij.testFramework.LightCodeInsightTestCase.runTest(LightCodeInsightTestCase.java:43) at com.intellij.testFramework.LightIdeaTestCase.d(LightIdeaTestCase.java:32) at com.intellij.testFramework.LightIdeaTestCase.a(LightIdeaTestCase.java:63) at com.intellij.testFramework.LightIdeaTestCase$4.run(LightIdeaTestCase.java:4) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171) at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Process terminated with exit code -1 ]]>

4 comments
Comment actions Permalink

Sertain bug. One placed some code that requires servlet.jsp into static
class initializer. You may work it around by adding servlet.jar into
classpath.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Alain Ravet" <alain_ravet@yahoo.com> wrote in message
news:27968203.1063664551841.JavaMail.itn@is.intellij.net...

Using IDEA TestFramework, I'm wrapping a few tests around Maxim S's
ComparingReferencesInspectionPlugin. The plugin
(http://www.intellij.org/twiki/bin/view/Main/InspectionPlugins)
still works fine with 926, but when called from a very basic
LightCodeInsightTestCase, it crashes on :


with a stacktrace, that strangely mentions
"javax/servlet/jsp/tagext/TagExtraInfo".
(There is no jsp in the project).

I wonder if I'm using the stuff in the wrong way, or if it's an IDEA bug. It
crashes as well in debug as in run mode.
I'm stuck.


Alain

Note : has anybody written test for inspections/intentions yet? Please
share.








The offending plugin line is line 96 :

    PsiType lType = lOperand.getType();  <== problems here

]]>






The test code that crashes the plugin :



(a.java:33) at com.intellij.psi.impl.source.bj.j(bj.java:202) at com.intellij.psi.scope.h.a(h.java:111) at com.intellij.psi.scope.h.a(h.java:122) at com.intellij.psi.scope.h.a(h.java:136) at com.intellij.psi.scope.h.a(h.java:159) at com.intellij.psi.impl.source.c.a.bh.b(bh.java:3) at com.intellij.psi.impl.source.c.a.bh.a(bh.java:78) at com.intellij.psi.impl.source.c.a.a.b(a.java:1) at com.intellij.psi.impl.source.c.a.a.a(a.java:16) at com.intellij.psi.impl.source.a.c.a(c.java:32) at com.intellij.psi.impl.source.c.a.bh.multiResolve(bh.java:25) at com.intellij.psi.impl.source.c.a.bh.advancedResolve(bh.java:90) at com.intellij.psi.impl.source.c.a.bh.getType(bh.java:13) at com.intellij.codeInspection.ComparingReferencesInspection$1.visitBinaryExpre ssion(ComparingReferencesInspection.java:96) at com.intellij.psi.impl.source.c.a.h.accept(h.java:42) at com.intellij.psi.impl.source.c.u.acceptChildren(u.java:47) at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElement Visitor.java) at com.intellij.psi.JavaElementVisitor.visitVariable(JavaElementVisitor.java:12 6) at com.intellij.psi.JavaElementVisitor.visitLocalVariable(JavaElementVisitor.ja va:107) at com.intellij.psi.impl.source.c.a.ba.accept(ba.java:64) at com.intellij.psi.impl.source.c.u.acceptChildren(u.java:47) at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElement Visitor.java) at com.intellij.psi.JavaElementVisitor.visitStatement(JavaElementVisitorjava:17 6) at com.intellij.psi.JavaElementVisitor.visitDeclarationStatement(JavaElementVis itor.java:51) at com.intellij.psi.impl.source.c.a.n.accept(n.java:15) at com.intellij.psi.impl.source.c.u.acceptChildren(u.java:47) at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElement Visitor.java) at com.intellij.psi.JavaElementVisitor.visitCodeBlock(JavaElementVisitorjava:76 ) at com.intellij.psi.impl.source.c.a.bt.accept(bt.java:13) at com.intellij.codeInspection.ComparingReferencesInspection.analyzeCode(Compar ingReferencesInspection.java:80) at com.intellij.codeInspection.ComparingReferencesInspection.checkMethod(Compar ingReferencesInspection.java:56) at testcase.BugSpike.test1(BugSpike.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at com.intellij.testFramework.LightCodeInsightTestCase.a(LightCodeInsightTestCa se.java:131) at com.intellij.testFramework.LightCodeInsightTestCase$2.run(LightCodeInsightTe stCase.java:4) at com.intellij.openapi.command.b.b.executeCommand(b.java:0) at com.intellij.testFramework.LightCodeInsightTestCase$1.run(LightCodeInsightTe stCase.java:2) at com.intellij.openapi.application.a.d.runWriteAction(d.java:177) at com.intellij.testFramework.LightCodeInsightTestCase.runTest(LightCodeInsight TestCase.java:43) at com.intellij.testFramework.LightIdeaTestCase.d(LightIdeaTestCase.java:32) at com.intellij.testFramework.LightIdeaTestCase.a(LightIdeaTestCase.java:63) at com.intellij.testFramework.LightIdeaTestCase$4.run(LightIdeaTestCase.java:4) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171) at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja va:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java :151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Process terminated with exit code -1 ]]>



0
Comment actions Permalink

Hi guys!

It is not a bug. We really need servlet.jar to handle some jsp issues. We import this class (TagExtraInfo) and JVM fails to check it. I strongly recommend you to add to your libs servlet.jar.

IK

0
Comment actions Permalink

Igor Kuralenok wrote:

> Hi guys!
> It is not a bug. We really need ..


OK, no big deal. I'll add servlet.jar to the project.


Note :
You marked the bug as "Not Repeatable". It should rather be "Do Not Fix"


Alain

0

Please sign in to leave a comment.