** Um zum Schluss von [hier] zu springen (#% E7% B5% 90% E8% AB% 96) **
Eines Tages, als ich versuchte, Groovy mit Groovy in Java konvertieren
in Java zu konvertieren, funktionierte es überhaupt nicht.
Es gibt kein Problem mit dem Code selbst, die Ursache ist unbekannt. Als ich mir das Protokoll ansah, bekam ich diesen Fehler ...
java.lang.UnsupportedOperationException
at org.jetbrains.plugins.groovy.refactoring.convertToJava.TypeWriter.visitDisjunctionType(TypeWriter.java:155)
at com.intellij.psi.PsiDisjunctionType.accept(PsiDisjunctionType.java:114)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.TypeWriter.writeType(TypeWriter.java:72)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.TypeWriter.writeType(TypeWriter.java:49)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.CodeBlockGenerator.writeVariableWithoutSemicolonAndInitializer(CodeBlockGenerator.java:481)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.CodeBlockGenerator.visitCatchClause(CodeBlockGenerator.java:534)
at org.jetbrains.plugins.groovy.lang.psi.impl.statements.GrCatchClauseImpl.accept(GrCatchClauseImpl.java:45)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.CodeBlockGenerator.visitTryStatement(CodeBlockGenerator.java:523)
at org.jetbrains.plugins.groovy.lang.psi.impl.statements.GrTryCatchStatementImpl.accept(GrTryCatchStatementImpl.java:43)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.CodeBlockGenerator.visitStatementOwner(CodeBlockGenerator.java:160)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.CodeBlockGenerator.generateCodeBlock(CodeBlockGenerator.java:152)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.CodeBlockGenerator.generateMethodBody(CodeBlockGenerator.java:119)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.ClassItemGeneratorImpl.writeMethod(ClassItemGeneratorImpl.java:159)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.ClassGenerator.writeAllMethods(ClassGenerator.java:149)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.ClassGenerator.writeMembers(ClassGenerator.java:124)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.ClassGenerator.writeTypeDefinition(ClassGenerator.java:106)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.ConvertToJavaProcessor.performRefactoring(ConvertToJavaProcessor.java:93)
at com.intellij.refactoring.BaseRefactoringProcessor.lambda$doRefactoring$11(BaseRefactoringProcessor.java:475)
at com.intellij.refactoring.BaseRefactoringProcessor.lambda$doRefactoring$12(BaseRefactoringProcessor.java:486)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runWriteActionWithProgressInDispatchThread$15(ApplicationImpl.java:980)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:548)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:493)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
at com.intellij.openapi.progress.util.PotemkinProgress.runInSwingThread(PotemkinProgress.java:167)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithProgressInDispatchThread(ApplicationImpl.java:980)
at com.intellij.refactoring.BaseRefactoringProcessor.doRefactoring(BaseRefactoringProcessor.java:486)
at com.intellij.refactoring.BaseRefactoringProcessor.lambda$execute$4(BaseRefactoringProcessor.java:314)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:149)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:109)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.refactoring.BaseRefactoringProcessor.execute(BaseRefactoringProcessor.java:312)
at com.intellij.refactoring.BaseRefactoringProcessor.doRun(BaseRefactoringProcessor.java:243)
at com.intellij.openapi.fileEditor.impl.NonProjectFileWritingAccessProvider.disableChecksDuring(NonProjectFileWritingAccessProvider.java:181)
at com.intellij.refactoring.BaseRefactoringProcessor.run(BaseRefactoringProcessor.java:553)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.ConvertToJavaHandler.invokeInner(ConvertToJavaHandler.java:73)
at org.jetbrains.plugins.groovy.refactoring.convertToJava.ConvertToJavaHandler.invoke(ConvertToJavaHandler.java:42)
at com.intellij.refactoring.actions.BaseRefactoringAction.actionPerformed(BaseRefactoringAction.java:131)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:216)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:86)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:151)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:231)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:310)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:911)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:136)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:300)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:117)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:86)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:109)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:118)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:117)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:513)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:45)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:533)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:821)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:645)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
WTF! Was zur Hölle Die zweite Zeile vom oberen Rand dieser Stapelverfolgung
at org.jetbrains.plugins.groovy.refactoring.convertToJava.TypeWriter.visitDisjunctionType(TypeWriter.java:155)
Zu untersuchen
visitDisjunctionType
Wenn Sie nach "visitDisjunctionType" suchen, finden Sie dieses Ding. PsiTypeVisitor.java # L62).
@Override
public Object visitDisjunctionType(@NotNull PsiDisjunctionType disjunctionType) {
//it is not available in groovy source code
throw new UnsupportedOperationException();
}
Das ist ein Fehler. Anscheinend repräsentiert das Argument "PsiDisjunctionType" eine Spezifikation wie "A | B".
Es scheint, dass "PsiType" erscheint, aber ich bin mir nicht sicher.
Es hat funktioniert, als ich es entsprechend geändert habe. Wenn Sie glauben, dass Sie etwas nicht konvertieren können, suchen Sie nach "A | B". Es kann sich im angegebenen Teil des Typs der "catch" -Klausel befinden. (Ich frage mich, ob es noch etwas gibt ...?)
Recommended Posts