History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-14559
Type: Exception Exception
Status: Reopened Reopened
Priority: Major Major
Assignee: Maxim Shafirov
Reporter: Alexander Chernikov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

JSP: Throwable through PsiJavaCodeReferenceElementImpl.multiResolve() on Introduce constant with Annotate with @NonNls option

Created: 19 Feb 07 18:17   Updated: 16 Oct 07 00:10
Component/s: J2EE.JSP, Refactoring
Fix Version/s: Diana Final

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 6,712


 Description  « Hide
Get a JSP with a string literal in java code, e.g.:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
	<head><title>Title</title></head>
	<body> <% String s = "value"; %> </body>
</html>

Perform Refactor / Introduce Constant for "value" literal. Set option to annotate with @NonNls. Ok. Result: constant is introduced, but String s = "value"; statement is not changed; and exception is thrown (see below).

All is Ok, if user performs changes step by step: first introduce a constant, second annotate with @NonNls.

Assertion failed: getManager() == null!
java.lang.Throwable
	at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:89)
	at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.multiResolve(PsiJavaCodeReferenceElementImpl.java:144)
	at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.advancedResolve(PsiJavaCodeReferenceElementImpl.java:5)
	at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.resolve(PsiJavaCodeReferenceElementImpl.java:156)
	at com.intellij.psi.impl.source.tree.ChangeUtil.decodeInformation(ChangeUtil.java:250)
	at com.intellij.psi.impl.source.tree.ChangeUtil.decodeInformation(ChangeUtil.java:365)
	at com.intellij.psi.impl.source.tree.ChangeUtil.decodeInformation(ChangeUtil.java:365)
	at com.intellij.psi.impl.source.jsp.jspJava.JspClassImpl.add(JspClassImpl.java:164)
	at com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler$1.run(BaseExpressionToFieldHandler.java:34)
	at com.intellij.openapi.application.impl.ApplicationImpl$13.compute(ApplicationImpl.java:2)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:93)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:74)
	at com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler$2.run(BaseExpressionToFieldHandler.java:1)
	at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:121)
	at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:98)
	at com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler.invokeImpl(BaseExpressionToFieldHandler.java:146)
	at com.intellij.refactoring.IntroduceHandlerBase.invoke(IntroduceHandlerBase.java:8)
	at com.intellij.refactoring.introduceField.IntroduceConstantHandler.invoke(IntroduceConstantHandler.java:66)
	at com.intellij.codeInspection.i18n.I18nInspection$13$1.run(I18nInspection.java:4)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:122)
	at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:107)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:115)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



com.intellij.psi.PsiInvalidElementAccessException: Element: class com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl
	at com.intellij.psi.impl.source.tree.CompositePsiElement.getContainingFile(CompositePsiElement.java:37)
	at com.intellij.psi.impl.source.tree.SharedImplUtil.isWritable(SharedImplUtil.java:17)
	at com.intellij.psi.impl.source.tree.CompositePsiElement.isWritable(CompositePsiElement.java:6)
	at com.intellij.psi.impl.CheckUtil.checkWritable(CheckUtil.java:17)
	at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.bindToElement(PsiJavaCodeReferenceElementImpl.java:92)
	at com.intellij.psi.impl.source.tree.ChangeUtil.decodeInformation(ChangeUtil.java:297)
	at com.intellij.psi.impl.source.tree.ChangeUtil.decodeInformation(ChangeUtil.java:365)
	at com.intellij.psi.impl.source.tree.ChangeUtil.decodeInformation(ChangeUtil.java:365)
	at com.intellij.psi.impl.source.jsp.jspJava.JspClassImpl.add(JspClassImpl.java:164)
	at com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler$1.run(BaseExpressionToFieldHandler.java:34)
	at com.intellij.openapi.application.impl.ApplicationImpl$13.compute(ApplicationImpl.java:2)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:93)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:74)
	at com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler$2.run(BaseExpressionToFieldHandler.java:1)
	at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:121)
	at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:98)
	at com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler.invokeImpl(BaseExpressionToFieldHandler.java:146)
	at com.intellij.refactoring.IntroduceHandlerBase.invoke(IntroduceHandlerBase.java:8)
	at com.intellij.refactoring.introduceField.IntroduceConstantHandler.invoke(IntroduceConstantHandler.java:66)
	at com.intellij.codeInspection.i18n.I18nInspection$13$1.run(I18nInspection.java:4)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:122)
	at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:107)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:115)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


 All   Comments   Work Log   Change History      Sort Order:
Maxim Shafirov - 13 Mar 07 17:08
Can't reproduce on 6756. Fixed?

Alexander Chernikov - 19 Mar 07 22:07
Selena 6767: cannot reproduce with initial test sample. But can reprouce with:
<%@ taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<html>
	<head><title>Title</title></head>
	<body>
		<core:out value="ddd"/>
		<% String s = "value"; %>
	</body>
</html>

Essential: an action (core:out) should be placed where it is shown. If it is placed after the scriptlet, the bug does not happen.