mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-14 23:09: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
|
||||
public void visitApply(JCMethodInvocation invocation) {
|
||||
try {
|
||||
if (!(invocation.meth.getClass().getField("sym").get(invocation.meth) instanceof MethodSymbol)) {
|
||||
return;
|
||||
}
|
||||
MethodSymbol method = (MethodSymbol) invocation.meth.getClass().getField("sym").get(invocation.meth);
|
||||
if (context.hasAnnotationType(method, JSweetConfig.ANNOTATION_ASYNC)
|
||||
&& !"void".equals(method.getReturnType().toString())) {
|
||||
|
||||
@ -146,7 +146,7 @@ public class GlobalBeforeTranslationScanner extends AbstractTreeScanner {
|
||||
context.countStaticInitializer(classdecl.sym);
|
||||
}
|
||||
}
|
||||
if (def instanceof JCMethodDecl) {
|
||||
if (def instanceof JCMethodDecl && ((JCMethodDecl) def).sym != null) {
|
||||
if (globals && ((JCMethodDecl) def).sym.isStatic()) {
|
||||
context.registerGlobalMethod(classdecl, (JCMethodDecl) def);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user