From 5d250a554043ff18fbe8332b6ac19d57bc2171f1 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Thu, 14 Sep 2017 18:37:27 +0300 Subject: [PATCH] javac ast indices: do not throw AIOOBE if anonymous superclass is not resolved (IDEA-178951) --- .../jps/backwardRefs/BackwardReferenceIndexUtil.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/BackwardReferenceIndexUtil.java b/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/BackwardReferenceIndexUtil.java index d0c83802e223..307604200c8d 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/BackwardReferenceIndexUtil.java +++ b/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/BackwardReferenceIndexUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package org.jetbrains.jps.backwardRefs; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Factory; import com.intellij.util.SmartList; import com.intellij.util.containers.ContainerUtil; @@ -28,6 +29,8 @@ import java.io.IOException; import java.util.*; public class BackwardReferenceIndexUtil { + private static final Logger LOG = Logger.getInstance(BackwardReferenceIndexUtil.class); + static void registerFile(String filePath, TObjectIntHashMap refs, List defs, @@ -50,6 +53,10 @@ public class BackwardReferenceIndexUtil { final LightRef.LightClassHierarchyElementDef aClass; if (sym.isAnonymous()) { final JavacRef[] classes = ((JavacDef.JavacClassDef)def).getSuperClasses(); + if (classes.length != 1) { + LOG.info("Seems that compilation will finish with errors in anonymous class inside file " + filePath); + continue; + } aClass = anonymousClassEnumerator.addAnonymous(sym.getName(), writer.asClassUsage(classes[0])); } else { aClass = writer.asClassUsage(sym);