-
Notifications
You must be signed in to change notification settings - Fork 14
Parser issues with names and string escape #35
Description
The nature of this issue is that there are alot of open problems about dealing with technially jvm valid input but invalid input regarding to antlr or jasm
public class java/lang/Example {
public test()V {
getstatic 1.0 I
}
}Results in: test.j : Cannot invoke "org.antlr.v4.runtime.tree.RuleNode.getChildCount()" because "node" is null
This should work because 1.0 is a valid path descriptor
Any class, extends, implements, method or field declaration fails when the access modifiers are used as names, but they should because they are valid jvm names
Example
public class public
extends private
implements final, static, private {
}Is technically valid by the JVM but jasm errors with: test.j : Cannot invoke "org.antlr.v4.runtime.tree.TerminalNode.getText()" because the return value of "com.roscopeco.jasm.antlr.JasmParser$ClassnameContext.QNAME()" is null
It is impossible to name lables, variables, methods after any instruction and it will fail with: test.j : Cannot read field "inputLocals" because "dstFrame" is null in the goto case.
Example:
public class java/lang/Example {
public test()V {
goto ldc
ldc:
return
}
}It is also impossible for invokex descriptors to contain any keywords
Example:
public class java/lang/Example {
public test()V {
invokevirtual ldc/private.final(goto)V
}
}Also string escape is not working on example:
public class java/lang/Example {
public test()V {
ldc "\"\\\\\\\""
}
}Which should just result in the string '"\"' but instead errors with: test.j : Errors: test.j:[4:22]: extraneous input '""'