Skip to content
This repository was archived by the owner on Nov 28, 2020. It is now read-only.
/ JRemapper Public archive
This repository was archived by the owner on Nov 28, 2020. It is now read-only.

Parse error with a class that contains functions named do/for/while #18

@artemking4

Description

@artemking4

I have a class, it contains method named "do", and the parser fails to parse it.

[ERRR:21.06.19 23:00]   (line 75,col 12) Parse error. Found "do", expected one of  "enum" "exports" "module" "open" "opens" "provides" "requires" "strictfp" "to" "transitive" "uses" "with" <IDENTIFIER>
Problem stacktrace :
  com.github.javaparser.GeneratedJavaParser.generateParseException(GeneratedJavaParser.java:10316)
  com.github.javaparser.GeneratedJavaParser.jj_consume_token(GeneratedJavaParser.java:10175)
  com.github.javaparser.GeneratedJavaParser.Identifier(GeneratedJavaParser.java:2154)
  com.github.javaparser.GeneratedJavaParser.SimpleName(GeneratedJavaParser.java:2093)
  com.github.javaparser.GeneratedJavaParser.MethodDeclaration(GeneratedJavaParser.java:1206)
  com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBodyDeclaration(GeneratedJavaParser.java:952)
  com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBody(GeneratedJavaParser.java:846)
  com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceDeclaration(GeneratedJavaParser.java:408)
  com.github.javaparser.GeneratedJavaParser.CompilationUnit(GeneratedJavaParser.java:154)
  com.github.javaparser.JavaParser.parse(JavaParser.java:130)
  me.coley.jremapper.ui.CodePane.setupRegions(CodePane.java:445)
  me.coley.jremapper.ui.CodePane.updateStyleAndRegions(CodePane.java:367)
  me.coley.jremapper.ui.CodePane.lambda$setupCode$1(CodePane.java:141)
  org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
  org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
  org.reactfx.FilterStream.lambda$observeInputs$0(FilterStream.java:20)
  org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
  org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
  java.util.Collections$SingletonList.forEach(Unknown Source)
  org.fxmisc.richtext.model.EditableStyledDocument$2.lambda$observeInputs$0(EditableStyledDocument.java:101)
  org.reactfx.util.QueuingStreamNotifications.lambda$head$0(NotificationAccumulator.java:217)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
  org.reactfx.SuspendableBase.resume(SuspendableBase.java:64)
  org.reactfx.CloseableOnceGuard.close(Guard.java:49)
  org.reactfx.MultiGuard.close(Guard.java:83)
  org.reactfx.Suspendable$1.resumeSource(Suspendable.java:118)
  org.reactfx.Suspendable$1.suspendSource(Suspendable.java:104)
  org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
  org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
  org.reactfx.EventStreams$3.lambda$observeInputs$0(EventStreams.java:105)
  org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786)
  org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
  org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
  org.reactfx.value.ValBase.invalidate(ValBase.java:32)
  org.reactfx.SuspendableBoolean.release(SuspendableBoolean.java:24)
  org.reactfx.CloseableOnceGuard.close(Guard.java:49)
  org.reactfx.Suspendable.suspendWhile(Suspendable.java:49)
  org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.updateMulti(GenericEditableStyledDocumentBase.java:215)
  org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.updateSingle(GenericEditableStyledDocumentBase.java:207)
  org.reactfx.util.Tuple3.exec(Tuple3.java:43)
  org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.replace(GenericEditableStyledDocumentBase.java:142)
  org.fxmisc.richtext.model.SimpleEditableStyledDocument.replace(SimpleEditableStyledDocument.java:10)
  org.fxmisc.richtext.GenericStyledArea.replace(GenericStyledArea.java:1195)
  org.fxmisc.richtext.GenericStyledArea.replaceText(GenericStyledArea.java:1182)
  org.fxmisc.richtext.EditActions.insertText(EditActions.java:32)
  org.fxmisc.richtext.EditActions.appendText(EditActions.java:15)
  me.coley.jremapper.ui.CodePane.refreshCode(CodePane.java:378)
  me.coley.jremapper.ui.CodePane.setupCode(CodePane.java:200)
  me.coley.jremapper.ui.CodePane.<init>(CodePane.java:120)
  me.coley.jremapper.ui.CodePane.open(CodePane.java:126)
  me.coley.jremapper.util.History.push(History.java:61)
  me.coley.jremapper.ui.ContentPane.onClassOpen(ContentPane.java:21)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  java.lang.reflect.Method.invoke(Unknown Source)
  me.coley.event.Bus$Handler$InvokeWrapper.post(Bus.java:189)
  me.coley.event.Bus$Handler.lambda$post$1(Bus.java:167)
  java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
  java.util.stream.SortedOps$SizedRefSortingSink.end(Unknown Source)
  java.util.stream.AbstractPipeline.copyInto(Unknown Source)
  java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
  java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
  java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
  java.util.stream.AbstractPipeline.evaluate(Unknown Source)
  java.util.stream.ReferencePipeline.forEach(Unknown Source)
  me.coley.event.Bus$Handler.post(Bus.java:167)
  me.coley.event.Bus.post_(Bus.java:86)
  me.coley.event.Bus.post(Bus.java:46)
  me.coley.jremapper.ui.FilePane$2.handle(FilePane.java:68)
  me.coley.jremapper.ui.FilePane$2.handle(FilePane.java:61)
  com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
  com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
  com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
  com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
  com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
  com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
  com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
  javafx.event.Event.fireEvent(Event.java:198)
  javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470)
  javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
  javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
  javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
  javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
  javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
  com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
  com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
  java.security.AccessController.doPrivileged(Native Method)
  com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$358(GlassViewEventHandler.java:432)
  com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
  com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
  com.sun.glass.ui.View.handleMouseEvent(View.java:555)
  com.sun.glass.ui.View.notifyMouse(View.java:937)
  com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
  com.sun.glass.ui.win.WinApplication.lambda$null$152(WinApplication.java:177)
  java.lang.Thread.run(Unknown Source)```

Activity

Col-E

Col-E commented on Jun 22, 2019

@Col-E
Owner

This is an issue to take up with JavaParser since the exception is raised by their code... However I did point you in this direction so that is my fault (Sorry, I didn't think that JavaParser would also fail on obfuscated code 🤦‍♂️)

I don't mean to start a wild-goose chase, but maybe try https://github.com/FabricMC/Enigma?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @artemking4@Col-E

        Issue actions