diff --git a/base/org.codehaus.groovy30/src/org/codehaus/groovy/vmplugin/v8/Java8.java b/base/org.codehaus.groovy30/src/org/codehaus/groovy/vmplugin/v8/Java8.java index c4f933a0ad..e713390a89 100644 --- a/base/org.codehaus.groovy30/src/org/codehaus/groovy/vmplugin/v8/Java8.java +++ b/base/org.codehaus.groovy30/src/org/codehaus/groovy/vmplugin/v8/Java8.java @@ -56,6 +56,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.GenericArrayType; +import java.lang.reflect.GenericSignatureFormatError; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.MalformedParameterizedTypeException; import java.lang.reflect.Member; @@ -438,9 +439,11 @@ public void configureClassNode(final CompileUnit compileUnit, final ClassNode cl setAnnotationMetaData(clazz.getPackage().getAnnotations(), packageNode); } } catch (NoClassDefFoundError e) { - throw new NoClassDefFoundError("Unable to load class " + classNode.toString(false) + " due to missing dependency " + e.getMessage()); - } catch (MalformedParameterizedTypeException e) { - throw new RuntimeException("Unable to configure class node for class " + classNode.toString(false) + " due to malformed parameterized types", e); + throw new NoClassDefFoundError("Unable to configure " + classNode.getName() + " due to missing dependency " + e.getMessage()); + } catch (TypeNotPresentException e) { + throw new NoClassDefFoundError("Unable to configure " + classNode.getName() + " due to missing dependency " + e.typeName()); + } catch (GenericSignatureFormatError | MalformedParameterizedTypeException e) { + throw new RuntimeException( "Unable to configure " + classNode.getName() + " due to malformed type info" , e); } } diff --git a/base/org.codehaus.groovy40/src/org/codehaus/groovy/vmplugin/v8/Java8.java b/base/org.codehaus.groovy40/src/org/codehaus/groovy/vmplugin/v8/Java8.java index e92bd3ceb5..e25f1eabe9 100644 --- a/base/org.codehaus.groovy40/src/org/codehaus/groovy/vmplugin/v8/Java8.java +++ b/base/org.codehaus.groovy40/src/org/codehaus/groovy/vmplugin/v8/Java8.java @@ -59,6 +59,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.GenericArrayType; +import java.lang.reflect.GenericSignatureFormatError; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.MalformedParameterizedTypeException; import java.lang.reflect.Member; @@ -448,9 +449,11 @@ public void configureClassNode(final CompileUnit compileUnit, final ClassNode cl setAnnotationMetaData(clazz.getPackage().getAnnotations(), packageNode); } } catch (NoClassDefFoundError e) { - throw new NoClassDefFoundError("Unable to load class " + classNode.toString(false) + " due to missing dependency " + e.getMessage()); - } catch (MalformedParameterizedTypeException e) { - throw new RuntimeException("Unable to configure class node for class " + classNode.toString(false) + " due to malformed parameterized types", e); + throw new NoClassDefFoundError("Unable to configure " + classNode.getName() + " due to missing dependency " + e.getMessage()); + } catch (TypeNotPresentException e) { + throw new NoClassDefFoundError("Unable to configure " + classNode.getName() + " due to missing dependency " + e.typeName()); + } catch (GenericSignatureFormatError | MalformedParameterizedTypeException e) { + throw new RuntimeException( "Unable to configure " + classNode.getName() + " due to malformed type info" , e); } } diff --git a/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/internal/compiler/ast/GroovyCompilationUnitDeclaration.java b/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/internal/compiler/ast/GroovyCompilationUnitDeclaration.java index 1eff4ed0ca..a67cac10d5 100644 --- a/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/internal/compiler/ast/GroovyCompilationUnitDeclaration.java +++ b/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/internal/compiler/ast/GroovyCompilationUnitDeclaration.java @@ -299,7 +299,7 @@ public boolean processToPhase(int phase) { if (GroovyLogManager.manager.hasLoggers()) { GroovyLogManager.manager.log(TraceCategory.COMPILER, e.getMessage()); } - if (!alreadyHasErrors) { + if (!alreadyHasErrors && compilationUnit.allowTransforms) { Util.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Groovy compiler error", e)); } // probably an AST transform compiled against a different Groovy diff --git a/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/model/GroovyCompilationUnit.java b/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/model/GroovyCompilationUnit.java index 28a912d257..8ccb3e1a5b 100644 --- a/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/model/GroovyCompilationUnit.java +++ b/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/model/GroovyCompilationUnit.java @@ -347,7 +347,7 @@ protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, if (e.getStatus().getCode() != IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST || getJavaProject().exists()) { Util.log(e, "Problem with build structure for " + this.name); } - } catch (Exception e) { + } catch (Exception | LinkageError | AssertionError e) { // The groovy compiler doesn't handle broken code well in many situations // use this general catch clause so that exceptions thrown by broken code // do not bubble up the stack. diff --git a/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/editor/GroovyAwareFoldingStructureProvider.java b/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/editor/GroovyAwareFoldingStructureProvider.java index a44bde57af..e0a35c4fce 100644 --- a/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/editor/GroovyAwareFoldingStructureProvider.java +++ b/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/editor/GroovyAwareFoldingStructureProvider.java @@ -70,24 +70,27 @@ public void uninstall() { @Override protected void computeFoldingStructure(final IJavaElement element, final FoldingStructureComputationContext context) { // NOTE: be sure to call super.computeFoldingStructure when editor is null to preserve Java behavior - if (editor != null && editor.getModuleNode() != null) { - if (isMainType(element)) { - // add folding for multi-line closures - computeClosureFoldingStructure(element, context); + try { + if (editor != null && editor.getModuleNode() != null) { + if (isMainType(element)) { + // add folding for multi-line closures + computeClosureFoldingStructure(element, context); - // TODO: add folding for multi-line strings or array/list/map literals? - } else if (isScriptMethod(element)) { - // add folding for multi-line comments - computeCommentFoldingStructure(element, context); + // TODO: add folding for multi-line strings or array/list/map literals? + } else if (isScriptMethod(element)) { + // add folding for multi-line comments + computeCommentFoldingStructure(element, context); - // TODO: add folding for top-level types? + // TODO: add folding for top-level types? - return; // prevent folding of entire script body - } + return; // prevent folding of entire script body + } - if (element instanceof IType) { - computeTraitMethodFoldingStructure((IType) element, context); + if (element instanceof IType) { + computeTraitMethodFoldingStructure((IType) element, context); + } } + } catch (Exception | LinkageError | AssertionError ignore) { } super.computeFoldingStructure(element, context); } diff --git a/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/refactoring/actions/OrganizeGroovyImports.java b/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/refactoring/actions/OrganizeGroovyImports.java index c9b1f051e9..3d4c62967a 100644 --- a/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/refactoring/actions/OrganizeGroovyImports.java +++ b/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/refactoring/actions/OrganizeGroovyImports.java @@ -258,8 +258,8 @@ public TextEdit calculateMissingImports() { TextEdit rewrite = rewriter.rewriteImports(monitor.split(1)); trace("%s", rewrite); return rewrite; - } catch (Exception e) { - GroovyPlugin.getDefault().logError("Exception thrown when organizing imports for " + unit.getElementName(), e); + } catch (Exception | LinkageError | AssertionError e) { + GroovyPlugin.getDefault().logError("Organize imports failed for " + unit.getElementName(), e); } finally { importsSlatedForRemoval = null; missingTypes = null;