mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 07:19:22 +00:00
fix occasional npe and cast exceptions when parsing Java code with compilation errors
This commit is contained in:
parent
6841f03327
commit
ea1aa4079b
@ -65,6 +65,9 @@ public class AsyncAwaitPropagationScanner extends AbstractTreeScanner {
|
|||||||
@Override
|
@Override
|
||||||
public void visitApply(JCMethodInvocation invocation) {
|
public void visitApply(JCMethodInvocation invocation) {
|
||||||
try {
|
try {
|
||||||
|
if (!(invocation.meth.getClass().getField("sym").get(invocation.meth) instanceof MethodSymbol)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
MethodSymbol method = (MethodSymbol) invocation.meth.getClass().getField("sym").get(invocation.meth);
|
MethodSymbol method = (MethodSymbol) invocation.meth.getClass().getField("sym").get(invocation.meth);
|
||||||
if (context.hasAnnotationType(method, JSweetConfig.ANNOTATION_ASYNC)
|
if (context.hasAnnotationType(method, JSweetConfig.ANNOTATION_ASYNC)
|
||||||
&& !"void".equals(method.getReturnType().toString())) {
|
&& !"void".equals(method.getReturnType().toString())) {
|
||||||
|
|||||||
@ -146,7 +146,7 @@ public class GlobalBeforeTranslationScanner extends AbstractTreeScanner {
|
|||||||
context.countStaticInitializer(classdecl.sym);
|
context.countStaticInitializer(classdecl.sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (def instanceof JCMethodDecl) {
|
if (def instanceof JCMethodDecl && ((JCMethodDecl) def).sym != null) {
|
||||||
if (globals && ((JCMethodDecl) def).sym.isStatic()) {
|
if (globals && ((JCMethodDecl) def).sym.isStatic()) {
|
||||||
context.registerGlobalMethod(classdecl, (JCMethodDecl) def);
|
context.registerGlobalMethod(classdecl, (JCMethodDecl) def);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user